- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cron issue
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
тАО07-22-2009 08:43 PM
тАО07-22-2009 08:43 PM
cron issue
Good Day
we create a cron entry in an ordinary user account, like given below:
* * * * * /tmp/scr.sh > /tmp/scr.log
when above executes, the scr.log always found empty?
Given below tests have been performed to diagnose/resolve:
1. execute /tmp/scr.sh manually through ordinary user account, all the commands sequentially executes without any problem.
2. we have replaced already written commands in scr.sh file with a single command like echo 'test-output' > /tmp/echo.out. and then run 'scr.sh' through cron; strangly it also run without any problem which is confusing me.
Now, some questions arose:
Why an echo command is executing through cron in scr.sh and the other commands NOT?
Why other commands are running without any problem when running on CLI like
chmod +x /tmp/scr.sh
/tmp/scr.sh
it runs fine, but through cron it won't?
Regards,
Muhammad Ahmad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 08:49 PM
тАО07-22-2009 08:49 PM
Re: cron issue
Can you try this..
* * * * * /tmp/scr.sh >> /tmp/scr.log
use append (>>) instead of diversion (>)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 08:56 PM
тАО07-22-2009 08:56 PM
Re: cron issue
Your checks :
1]Check cron daemon is working properly, by using other simple test script.
2]Arrange the cron entry as mentioned below,so that you will get the details of errors you will get while excuting.
***** /tmp/scr.sh 2>>/tmp/scr.log.
3]Check the shell you are keeping as a magic line while starting the script.
3]Check whther you ve any line which clears executable logs.
Please check and let me know result as well as share script contents to check.
Rgds
Yogesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-22-2009 09:11 PM
тАО07-22-2009 09:11 PM
Re: cron issue
If you want to redirect the standard output and standard errors produced by the script to a file, you should use like below.
* * * * * /tmp/scr.sh > /tmp/scr.log 2>&1
or to avoid overwrite
* * * * * /tmp/scr.sh >> /tmp/scr.log 2>&1
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2009 02:02 AM
тАО07-23-2009 02:02 AM
Re: cron issue
It is possible you don't have PATH set properly for the command you want to execute, so you get no output. cron has a limited PATH. That's why it works when you do it manually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2009 02:53 AM
тАО07-24-2009 02:53 AM
Re: cron issue
As a test Spaces can be safely removed and if there is a problem executing you can also redirect the error message to the file
please try executing the following command via command line and check if it works
sh -x /tmp/scr.sh>>/tmp/scr.log
this way you can confirm if there are any error that occurred executing the command
then could you try the following please
* * * * * /tmp/scr.sh>>/tmp/scr.log 2>&1