CronJob every 25 minutes
The command in crontab is executed with /bin/sh
so you can use arithmetic expansion to calculate whether the current minute modulo 25 equals zero:
*/5 * * * * [ $(( $(date +\%s) / 60 \% 25 )) -eq 0 ] && your_command
cron
will run this entire entry every 5 minutes, but only if the current minute (in minutes since the epoch) modulo 25 equals zero will it run your_command
.
As others have pointed out, 1 day is not evenly divisible by 25 minutes, so this will not cause your_command
to run at the same time every day, but it will run every 25 minutes.
Your best bet is to run at 20 minutes or 30 minutes.
You next best might be to trigger every 5 minutes, and then keep an internal count or timestamp, and run every 5th trigger, or if 25 minutes have elapsed since the last run.
More complicated would be to work out the correct times for a day, starting at midnight, and accept the error at the end of the day. This would involve duplicating the crontab entry to the different hours.
More complicated than that would be to work out the times for an entire month, which would involve many copies of the crontab entry to cover the different combinations.
Finally you could implement your own always on daemon, and have that do the scheduling.
I have no direct experience with it, but fcron appears to do what you want out of the box. According to its documentation you can specify frequencies:
# Get our mails every 30 minutes
@ 30 getmails -all
# make some security tests every 48 hours of system up time,
# force a mail to be sent to root even if there is no output
@mailto(root),forcemail 2d /etc/security/msec/cron-sh/security.sh