- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: crontab not working
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
Discussions
Discussions
Discussions
Forums
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
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
тАО03-09-2011 12:37 AM
тАО03-09-2011 12:37 AM
crontab not working
When i tried to run the script manually its working.
But in crontab its not running.
entry is::
13 13 * * 3 /usr/bin/sh /UX-DR/IS/syslog/Syslog_Analysis_Script.sh
every wednesday 01.13 PM i need to run.
Please help where i can check the error.
What may the possible error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-09-2011 01:04 AM
тАО03-09-2011 01:04 AM
Re: crontab not working
13 13 * * 3 /usr/bin/sh /UX-DR/IS/syslog/Syslog_Analysis_Script.sh 1>/tmp/Syslog_Analysis_Script.sh.out 2>/tmp/Syslog_Analysis_Script.sh
look for possible errors in that file. The most frequent problem with a cron script is, that it does not inherit the environmental variables from your shell. (like PATH)
So probably you forgot to use declaring commands with full path. But look at the output and you'll see the problem.
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-09-2011 10:02 AM
тАО03-09-2011 10:02 AM
Re: crontab not working
$ env > /tmp/mycommandline.env
and add that command to your script
env > /tmp/mycron.env
Then check that you are giving the full path to commands in your script.
Read the man page on cron, crontab for further information such as:
The shell is invoked from your $HOME directory with an arg0
of sh. Users who desire to have their .profile executed must
explicitly do so in the crontab file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-09-2011 10:03 AM
тАО03-09-2011 10:03 AM
Re: crontab not working
1. File permission (execute permission).
2. Path of the script (specify the complete path), from your example the file should be located in root (/).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-09-2011 10:30 AM
тАО03-09-2011 10:30 AM
Re: crontab not working
Is cron running?
ps -ef | grep cron
post
Check /etc/rc.config.d/cron
Make sure it is set to auto start.
/sbin/init.d/cron start
Also note that the environment on cron is different than the user environment.
PATH and such needs to be set in your script.
env > /tmp/env.txt
Good diagnostic tool for the script being run in cron
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-09-2011 12:16 PM
тАО03-09-2011 12:16 PM
Re: crontab not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-10-2011 02:23 AM
тАО03-10-2011 02:23 AM
Re: crontab not working
This should work. Do you get any mail with any error messages?
Typically you don't need to use /usr/bin/sh in your crontab entry.
You should have "#!/usr/bin/sh" in your script.