I'm currently testing, and instead of setting the cron jobs to run every minute, is there a command which I can execute that'll run the cronjobs immediately?
2 Answers
No there isn't.
Of course you can implement a different way, not using crond.
You can wrap your jobs into a script, being normally launched by cron, which you can therefore run by hand whenever you need
- Ok, thanks for your comment. crontab is executed under which user? It would be useful to know so that I can set all the correct file permissions etc. Thank you.Jamie– Jamie2010-03-01 10:03:51 +00:00Commented Mar 1, 2010 at 10:03
- 1there is a user crontab, and a system wide one. Run crontab -e to edit the user's one; edit /etc/crontab to act upon the system wide one.drAlberT– drAlberT2010-03-01 10:10:41 +00:00Commented Mar 1, 2010 at 10:10
- 1In general, a simple way to determine the environment in which cron is executing your job is to have cron run /usr/bin/env and examine the output. (eg, look for the value of USER)William Pursell– William Pursell2010-03-01 17:08:26 +00:00Commented Mar 1, 2010 at 17:08
I use this which runs scripts in much the same environment as cron:
echo "command" | at NOW - 2Except that
atpicks up the current environment; also,diff -u /etc/pam.d/{cron,atd}shows a few differences.Tobu– Tobu2010-07-01 16:25:58 +00:00Commented Jul 1, 2010 at 16:25