sleep 3600 && poweroff
However, this couldn't work, since root privileges are necessary to run poweroff command. So you have to use:
sleep 3600 && sudo poweroff
But this will cause the computer to wait for 1 hour (3600 seconds) and then prompt for the root password. And what we are trying to avoid is sitting in front of the computer at that time.
But there is a very simple solution:
- Type sudo visudo to edit the /etc/sudoers file.
- Add the following line:
Now you can execute sudo poweroff without typing the password.
No comments:
Post a Comment