Reputation: 63
I want to use cron to run a task a random number of times every 3 minutes and 30 seconds, between 8 a.m. and 6 p.m. They could help me with this problem. I've been searching, but I have not managed to do it. Thank you very much in advance.
Upvotes: 1
Views: 365
Reputation: 1304
I would address the issue two ways - depending on the requirement:
As for the cron, you may find this page useful to assemble it :)
Here a follow-up on the comment, that the use case refers to the second one I mentioned above:
script
random_times=$(( ( RANDOM % 10 ) + 1 ))
for i in `seq 1 $random_times`; do bash /path/to/script.sh; done
crontab
*/3 * * * *
Please notice, that if using unix crontab, you do not have seconds granularity and thus will execute every 3 minutes.
Upvotes: 1