LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   Cron Job (https://www.linuxquestions.org/questions/fedora-35/cron-job-741946/)

esuradi 07-22-2009 09:11 AM

Cron Job
 
Hello All ;

I have issued a script that doing bunch of things and save the results on many files through redirecting the output during the runtime of the script itself, where the files that contains the results are usually saved in the same directory of the script.

my quastion is : is it possible to make a cron job that do run that script automaticlly ? as i tried to do that but it didn't. as i also noticed that from the cron log it seems that my script is being run from cron but no reult are generated or files created .

Please advice.

repo 07-22-2009 09:14 AM

Make sure the script has the full path to all the commands
eq
/bin/rm
/usr/bin/rsync
etc

colucix 07-22-2009 10:22 AM

As suggested by repo, use full paths of both the commands and the files in your script. Also check the crontab owner's mail to look for messages from the script execution. Standard output and standard error not redirected to a file are sent to the owner's mail by default. In alternative you can explicitly redirect stdout and stderr to a file and check it after the job execution:
Code:

5 8 * * * /path/to/script.sh > $HOME/cron.log 2>&1


All times are GMT -5. The time now is 03:01 PM.