- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Scripts from cron does'nt execute.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 03:43 AM
02-01-2001 03:43 AM
On a 64 bit hp-ux 11.00 the following occurs:
Running a script manually succeeds:
ksh>/path/script.sh
Entering the same script into crontab:
30 10 * * * /path/script.sh >/dev/null 2>&1
does'nt work.
In /var/adm/cron/log the entries:
>CMD:/path/script.sh >/dev/null 2>&1
>bico 2226 c Thu Feb 1 10:30:00 MET 2001
Other scripts succeeds with the following log entries:
>CMD:/path/test_script.sh >/dev/null 2>&1
>bico 2302 c Thu Feb 1 10:45:00 MET 2001
>bico 2302 c Thu Feb 1 10:45:01 MET 2001
What is wrong?
Whats the rc=1 entry in the log?
Andreas
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 03:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 03:56 AM
02-01-2001 03:56 AM
Re: Scripts from cron does'nt execute.
I think rc=1 mean the process return code was 1.
regards, Saa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 03:56 AM
02-01-2001 03:56 AM
Re: Scripts from cron does'nt execute.
Make sure the user trying to excecute is allowed entry. (as the job is scheduled this is probably not the problem)
Next make sure that your script is defined in cron as
30 10 * * * /full/path/to/binary/script.sh
Make sure the execute bit is set for the user running the script.
Lastly and most importantly is the internals of the script. Many times PATH is not set, and standard commands are executed without the full path.
If your lazy like me in your scripts define PATH and export for your external calls as well. If you are security minded, then use full paths to binaries.
I.E.
MYVAR=`/usr/bin/ps -ef|/usr/bin/grep top|/usr/bin/grep -v grep |/usr/bin/head -1|/usr/bin/awk '{print $2}'`
/bin/kill "$MYVAR"
You have to remember that your interactive shells have executable directories set, which will cause scripts to work, where in a raw shell (from at or cron) it will fail.
The easiest way to test this is by unsetting PATH(path in cshell) in ksh or sh and trying to execute your script.
Another thing I always recommend is to have your scripts LOG commands and actions. It is pretty easy to make a /tmp/myscript.log, remove it if it exists and then touch it. Pipe script output to /tmp/myscript.log.
This will tell you exactly what is going on. I.E grep not found, awk not found,etc...
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 03:57 AM
02-01-2001 03:57 AM
Re: Scripts from cron does'nt execute.
executable (e.g. -rwx-r-x-r-x)
runing ksh scriptname will execute it even if
the permissions are wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2001 06:40 AM
02-01-2001 06:40 AM
Re: Scripts from cron does'nt execute.
It turned out that an undefined enviroment variable was the cause..
Andreas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2001 04:02 PM
03-07-2001 04:02 PM
Re: Scripts from cron does'nt execute.
rc=1 entry means return code of the program.
-Jaimin Parikh