-
creating cron job
hi,
I have written one cron.txt in which i have put
Code:
1,5,10,15 * * * * /root/foo.sh
then typed
crontab cron.txt
to lad the cron job.
and also foo.sh contains a command to run a C program executable.
This is not working.Please guide me to write a cronjob which will run after every 5 mins to run the script foo.sh
Thank You,
Nitin
-
http://www.hmug.org/man/1/crontab.php
Check these files
/var/cron/allow
/var/cron/deny
If you're not allowed, or denied, then you can't use cron.
-
Salem ,
I have /etc/cron.d/cron.deny which is empty.this means I can execute crontab command.
I followed following steps.
Code:
1) I created foo.sh shell script which runs a expect script for SCP.And it is running successfully.
2) then I created cron.job which contains.
1,5,10 * * * * /root/foo.sh
this means I want to execute foo.sh at 1,5,10 mins
3) then loaded this job by executing
crontab cron.job
-
Hmmm, I was unaware that one could create a separate file that would load the cron job. I have always just done crontab -e (as root, which it looks you are too) then added the line to the root user file (that'd be something along the lines of */5 * * * * /root/foo.sh).
When crontab is complete, it signals crond to reload the config file that was just edited.
Also, your script will need to be executable, and no assuptions can be made about the path that you use. You'll either need to use fully qualified filenames or set the environmental variable PATH at the top of your script.