How would I get a cron job to run every 30 minutes?
Do: 0,30 * * * * your_command
Do: 0,30 * * * * your_command
Add this to your crontab (temporarily): * * * * * env > ~/cronenv After it runs, do this: env – `cat ~/cronenv` /bin/sh This assumes that your cron runs /bin/sh, which is the default regardless of the user’s default shell. Footnote: if env contains more advanced config, eg PS1=$(__git_ps1 ” (%s)”)$, it will error … Read more
Try with: @Scheduled(cron = “0 1 1 * * ?”) Below you can find the example patterns from the spring forum: * “0 0 * * * *” = the top of every hour of every day. * “*/10 * * * * *” = every ten seconds. * “0 0 8-10 * * *” … Read more
Just do: 0 */2 * * * /home/username/test.sh The 0 at the beginning means to run at the 0th minute. (If it were an *, the script would run every minute during every second hour.) Don’t forget, you can check syslog to see if it ever actually ran!
* * * * * myjob.sh >> /var/log/myjob.log 2>&1 will log all output from the cron job to /var/log/myjob.log You might use mail to send emails. Most systems will send unhandled cron job output by email to root or the corresponding user.
For the original question, asking about Windows XP (and Windows 7): Windows Task Scheduler For command-line usage, you can schedule with the AT command. For newer Microsoft OS versions, Windows Server 2012 / Windows 8, look at the schtasks command line utility. If using PowerShell, the Scheduled Tasks Cmdlets in Windows PowerShell are made for … Read more
Avoid PID-files, crons, or anything else that tries to evaluate processes that aren’t their children. There is a very good reason why in UNIX, you can ONLY wait on your children. Any method (ps parsing, pgrep, storing a PID, …) that tries to work around that is flawed and has gaping holes in it. Just … Read more
You should be able to do this by using the python in your virtual environment: /home/my/virtual/bin/python /home/my/project/manage.py command arg EDIT: If your django project isn’t in the PYTHONPATH, then you’ll need to switch to the right directory: cd /home/my/project && /home/my/virtual/bin/python … You can also try to log the failure from cron: cd /home/my/project && … Read more
I’ve used the extremely popular Whenever on projects that rely heavily on scheduled tasks, and it’s great. It gives you a nice DSL to define your scheduled tasks instead of having to deal with crontab format. From the README: Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs. … Read more
To run a task every 20 minutes starting at 5 past the hour, try this: 5-59/20 * * * * Explanation An * in the minute field is the same as 0-59/1 where 0-59 is the range and 1 is the step. The command will run at the first minute in the range (0), then … Read more