- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Problem with Cron job.
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
тАО09-16-2007 07:51 PM
тАО09-16-2007 07:51 PM
Problem with Cron job.
I have stupid problem with cron job like as follows.
For example : I have some scripts with 755 permissions. Sometimes i get status from scripts, but sometimes i donot status from few scripts.
If i run the script as " # sh <script name>" as root user, then I get the status of the script, but sometimes script doesnot work.
This happens only for few scripts.
I donot see any problem with sendmail / cron daemon.
For save side, I restarted the sendmail, and cron daemon, then also same problem.
Please guide how to rectify it.
Regards,
Viswa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2007 08:01 PM
тАО09-16-2007 08:01 PM
Re: Problem with Cron job.
"Sometimes i get status from scripts, but sometimes i donot status from few scripts"
This is not really a good explanation of a problem.
But what you can check is if you are using always fully qualified pathes for any commands you call.
For example "/usr/bin/ls" instead of only "ls".
See
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1161570
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2007 08:11 PM
тАО09-16-2007 08:11 PM
Re: Problem with Cron job.
In cron file, I use fullpath as
For example :
12 1 * * * /usr/local/root/scriptname
with 755 file permissions.
The same script working for some server(s), but the same script sometimes donot work for some server.
Regards,
Viswa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2007 08:39 PM
тАО09-16-2007 08:39 PM
Re: Problem with Cron job.
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2007 08:54 PM
тАО09-16-2007 08:54 PM
Re: Problem with Cron job.
Im redirecting the output to a file. I see the result in the output file. But sometimes im not getting the respective output.
Later i get mail about the result from output file as
# mailx -s "Subject" mailid@domain.com
Regards,
Viswa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2007 09:15 PM
тАО09-16-2007 09:15 PM
Re: Problem with Cron job.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2007 09:46 PM
тАО09-16-2007 09:46 PM
Re: Problem with Cron job.
Yes sometimes log is updating, and sometimes not updating.
I restarted the cron daemon, but im getting the same proble.
Regards,
Viswa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2007 03:00 PM
тАО09-17-2007 03:00 PM
Re: Problem with Cron job.
You could use "set -x" to trace your commands to see where it is stopping.
>and sometimes not updating.
If you don't have anything in /var/adm/cron/log then it never started.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2007 03:44 PM
тАО09-17-2007 03:44 PM
Re: Problem with Cron job.
I would suggest the following steps for checking cron script issues :
1. Cron will only supply a few variables to
your script, so use complete PATHs whereever needed
cron supplied variables
HOME=user's-home-directory
LOGNAME=user's-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
2. for cronjobs its always good practice to
redirect the standard output and standard error to another log file, and that will help you to troubleshoot
so your job should be
12 1 * * * /usr/local/root/scriptname > /usr/local/root/scriptname.log 2>&1
now you should get the output and errors in /usr/local/root/scriptname.log file
you can also append the log file name with
date or time stamps so that they are not overwritten each time
eg: scriptname.log.`date +%d%m%y%H%M%Y` etc
or you can also keepon appending to the same file
ie 12 1 * * * /usr/local/root/scriptname >> /usr/local/root/scriptname.log 2>&1
3. check the cron user that you are using and it has the proper permissions for the script , the log files etc
4. use the correct shell in the first line of the script, and ensure that it exists
and maintain it uniformally on all servers
ie #!/usr/bin/sh or #!/usr/bin/ksh
5. check the cron log file - /var/adm/cron/log and see if the job is executed , u should get the time when the job runs and the exit status etc
check for rc=1 [ ie non zero exit status will normally indicate error ]
hope this helps in troubleshooting the problem.
Regards,
Devaraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2007 06:47 PM
тАО09-17-2007 06:47 PM
Re: Problem with Cron job.
I tried to debug the script ( tail -f /var/adm/cron/log ), and redirected the output to a file.
In log file i did not see any error ( rc=1 ).
Unfortunately in the predefined script I saw a mail id ( the output goes to this mail id).
I have to work out for the mail id.
Thanks to All.
Regards,
Viswa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-17-2007 06:56 PM
тАО09-17-2007 06:56 PM