Hello everyone, I have a mini pc beelelink u59 pro with dietpi installed, I would like to save some energy and turn it off every day at 00:00… Can anyone help me with a script? And I would also like to ask 2 questions To turn it on automatically I wouldn’t be able to do that By the correct script? What if I wanted to disable it in the future just delete the script file?
One option would be to add command e.g. ‘shutdown -h now’ in a cron job set to time you want it to shutdown.
If you have shut it down then you can’t script to restart.
Suggest an independent timer on the power supply to kill power after shutdown.
Not familiar with you PC, but if it boots on power up the timer would restart it.
yes using cron
would be the easiest option to shutdown a system
OK thanks. Does Dietpi have any settings, let’s say an easy way to do this? Or do I need to create a script for this?
crontab -e
add string
0 0 * * * poweroff
I think will do
This has nothing to do with DietPi. cron
is a common scheduler on Linux and there are many guides on the web on how to stop a system using cron
.
always use the full path to the command. Like /usr/sbin/shutdown -h now
There are well sites to calculate cron
setting https://crontab.guru/
poweroff, init 0, shutdown now, halt is same command))
There is a dietpi script , try
dietpi-cron
This will just allow to manage timers but it will not allow to add entries into cron
Correct, my comment was not about the command itself but more a hit to use the full path as just using the command might not work.
Thank you all very much for your help.
I did what guide and it worked, it turned off at 00:00.
crontab -e
And I added it to the file >>>
0 0 * * * /usr/sbin/shutdown -h now
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.