Different cron jobs at different times Topic is solved

Suggestions for features and software you would like to see in DietPi, goes here.
Post Reply
MoreNoob0815

Different cron jobs at different times

Post by MoreNoob0815 »

Hello.

Thanks for the awesome distribution. It makes the pi run faster and smoother than the standard distributions.

For some automation I like to run several cron jobs at different times. E.g. run every day
script1 @ time1
script2 @ time2
script3 @ …

If all scripts are in the cron.daily folder then all will be run at the time cron.daily is set (in dietpi-cron). But not at different times?
How would that be possible? Adding additional daily folders to crontab doesn't work.

Thanks.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Different cron jobs at different times

Post by Fourdee »

MoreNoob0815 wrote:Hello.

Thanks for the awesome distribution. It makes the pi run faster and smoother than the standard distributions.

For some automation I like to run several cron jobs at different times. E.g. run every day
script1 @ time1
script2 @ time2
script3 @ …

If all scripts are in the cron.daily folder then all will be run at the time cron.daily is set (in dietpi-cron). But not at different times?
How would that be possible? Adding additional daily folders to crontab doesn't work.

Thanks.
Hi,

I think you'll be limited with Cron. Its only designed to execute all scripts in /etc/cron.* at a specific time, based on their name (eg: daily/hourly etc).

A simple "cheat" would be to have a master script and delay the execution of the commands, eg /etc/cron.hourly/dothis

Code: Select all

#!/bin/bash

#Run script 1
/etc/myscript1.sh

#Wait 600 seconds after the above script is finished, before running the next
sleep 600
/etc/myscript2.sh
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
MoreNoob0815

Re: Different cron jobs at different times

Post by MoreNoob0815 »

Good to know. I'll try that then.
Thanks for the reply.
mike175de
Posts: 67
Joined: Sat Sep 05, 2015 4:39 pm

Re: Different cron jobs at different times

Post by mike175de »

Hi there,

Webmin offers a good GUI to set cron jobs with different times. But you have to install Webmin as a serice.

Greets, mike175de
Post Reply