Hello All
What would be a way for me to auto shutdown my computer everyday at 10:30PM
Linux mint 18.1 Cinnamon
(Solved)Auto shutdown at 10:30PM daily
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
(Solved)Auto shutdown at 10:30PM daily
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Auto shutdown at 10:30PM daily
crontab is your friend:
sudo crontab -e
and add this lines:
sudo crontab -e
and add this lines:
Code: Select all
# shutdown every night at 22:30
30 22 * * * /sbin/shutdown -h now
Linux...
-
- Level 5
- Posts: 633
- Joined: Sat Dec 26, 2009 3:36 pm
Re: Auto shutdown at 10:30PM daily
This is one of those that might have more than one good answer.
But I think the typical unix way would be to run a cron job. Which you can do by editing your crontab file. The following for example would add the needed line to /etc/crontab:
The line actually added to the file is everything between the " quotes. You could also just open an editor as root and add this line. The 30 22 is just minutes, hours (in 24 hr format), so means 10:30 PM. The three stars after that indicate to run every day, every month, every day of the week. Then you have the user to run the command, and the command to be run.
edit: ah, now3by beat me to it. And using crontab -e looks like the easiest way to edit the file.
But I think the typical unix way would be to run a cron job. Which you can do by editing your crontab file. The following for example would add the needed line to /etc/crontab:
Code: Select all
sudo bash -c 'echo "30 22 * * * root /sbin/shutdown -h now" >> /etc/crontab'
edit: ah, now3by beat me to it. And using crontab -e looks like the easiest way to edit the file.
Last edited by acerimusdux on Mon Jun 12, 2017 1:14 pm, edited 1 time in total.
Re: Auto shutdown at 10:30PM daily
Agreed that there numerous ways to shut down and will try the following for tonight
And if no go will try your other options. Thanks guys
Code: Select all
# m h dom mon dow command
30 22 * * * sudo poweroff
-
- Level 5
- Posts: 633
- Joined: Sat Dec 26, 2009 3:36 pm
Re: Auto shutdown at 10:30PM daily
Don't think you want to run sudo from crontab. If you use roots crontab (in /etc/crontab, accessed by sudo crontab -e) it will already run with root permissions. And actually, you don't need to be root to run shutdown in Mint. So you could just do crontab -e, and add the poweroff -h command there.
Re: Auto shutdown at 10:30PM daily
Much appreciated. Will revise. Thanksacerimusdux wrote:Don't think you want to run sudo from crontab. If you use roots crontab (in /etc/crontab, accessed by sudo crontab -e) it will already run with root permissions. And actually, you don't need to be root to run shutdown in Mint. So you could just do crontab -e, and add the poweroff -h command there.
Re: Auto shutdown at 10:30PM daily
Only gsShutdown app does the job. All crontab commands do not work for me.