how to reboot DietPi always at 8AM with Cron?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
vinanrra
Posts: 5
Joined: Mon Oct 24, 2016 4:57 pm

how to reboot DietPi always at 8AM with Cron?

Post by vinanrra » Thu Feb 08, 2018 7:31 pm

I'm new with Cron and I don't know how to do it, and even with tutorials I don't make works

Edward
Posts: 28
Joined: Sun Apr 09, 2017 5:24 am

Re: how to reboot DietPi always at 8AM with Cron?

Post by Edward » Thu Feb 08, 2018 7:39 pm

I'm thinking you could add a line to the /etc/cron.daily file like this

0 8 * * * /sbin/shutdown -r

It should reboot daily at 8AM.

Or better yet go to dietpi-launcher ->Dietpi-Cron and adjust the time from there.
Then add the command in cron.daily

User avatar
MichaIng
Legend
Posts: 208
Joined: Sat Nov 18, 2017 5:21 pm

Re: how to reboot DietPi always at 8AM with Cron?

Post by MichaIng » Thu Feb 08, 2018 11:04 pm

Please do not add it to cron.daily!! The scripts inside are running in parallel and AFAIK the shutdown/reboot would break all other daily tasks.

Create a crontab entry for root user instead:
1. crontab -e
2. add the line mentioned by Edward: 0 8 * * * /sbin/shutdown -r
3. save with ctrl + o
4. verify: crontab -l

vinanrra
Posts: 5
Joined: Mon Oct 24, 2016 4:57 pm

Re: how to reboot DietPi always at 8AM with Cron?

Post by vinanrra » Fri Feb 09, 2018 12:07 am

Thx, for the info :)

Post Reply