I am using both Ubuntu and Lubuntu 16.04 and this question is regarding both of them.
I want my computer to always shut down 2 hours after it was turned on, i tried to use these instructions that I found to run a timed shutdown on startup but it does not work.
How can I do that?
21 Answer
1.Edit sudoers (you must be root):
gedit /etc/sudoers At the end add following:
yourusername ALL=(ALL) NOPASSWD: /sbin/shutdown and save.
2.Crete .sh script:
gedit myscript.sh add following there:
#!/bin/sh sudo shutdown -P +120 # shut down after 120 minutes 3.run "startup applications" tool you just need write it in search box. And press Add button:
Write there your .sh script name and path to it. Press add there too.

