This question already has answers here: As we already know that the pattern * */2 * * * executes the task for every 2 hour, similary can * * */2 * * execute the task for every 2 day (once in 2 days).
It is a wildcard for every part of the cron schedule expression. So * * * * * means every minute of every hour of every day of every month and every day of the week .
2 is the file descriptor for STDERR and 1 is the file descriptor for STDOUT. The > sign is the redirection operator.
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!
The line should read either:
0 0-23/2 * * * /home/username/test.sh
or
0 0,2,4,6,8,10,12,14,16,18,20,22 * * * /home/username/test.sh
0 */2 * * *
The answer is from https://crontab.guru/every-2-hours. It is interesting.
0 */1 * * * “At minute 0 past every hour.”
0 */2 * * * “At minute 0 past every 2nd hour.”
This is the proper way to set cronjobs for every hr.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With