Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Csh script not running under cron 2

Status
Not open for further replies.

fvctrn

IS-IT--Management
Oct 3, 2005
6
0
0
GB
I have a csh file that does backups for specific application. This file was written by a third party vendor and when run via root on the command line executes perfectly, but when I added the script to the cron job it doesn't seem to work (cron is running fine with normal commands such as ps -ef > /etc/test.txt). I have looked at /var/cron/log and I see the file processed, but I'm not sure if it ran. It should have created folders and directories, but it did not do so with the cron. The script has the "#!/bin/csh" on the first line. Any ideas to fix thsi problem would be much appreciated. Thank you!
 
cron runs in a very limited environment, so it's likely that some variable ($PATH is the usual suspect) isn't being set to allow your job to run. Make sure that your script includes an export $PATH=<path when run interactively> at or near the start of the script so that it is picked up when run via cron. Hope this helps.
 
Sorry, that's export PATH=<path when run interactively>, ie leave off the $ I included above.
 
Cron doesn't care for the #!/bin/csh line. I run these csh scripts like this:
Code:
0 * * * * csh -c "/path/to/the/script.csh"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top