2

For a long a long time its been a problem for me (the human) to go to sleep early. A part of the problem is definitely that I often been to long by the computer at night I mess up my day rhythm and my life.

How can I solve this I would love to tell my computer to turn of at a certain time of the day? And give me a count down and be able to turn on again if I really need to turn it on afterwards and then be put to sleep again. Is there a thing like that?

I found this but I don't know how to implement it. I'm a bit noob at Linux.

3

the easiest way would be through the command line:

try sudo shutdown -P 60 to shut down the machine in 60 minutes.

Alternatively you could set a time to shut down, using 24h format. For example sudo shutdown -P 1:00 will shut down the machine at 1:00 AM in the morning.

sudo shutdown -P now will shut down the CPU right away, e.g. now.

Hope that helps.

  • Thanks the sudo shutdown -P 1:00 did the trick. Is there a way that it can come on everyday automatically? – Martin Moltke Wozniak Feb 13 '16 at 22:07
  • You can most likely script it if you have some experience. Maybe this helps you: ubuntu.flowconsult.at/linux/… – BenjB Feb 13 '16 at 22:25
  • I tried to make the script.. but it failed. I get this message (maybe I should make a new thread?): (gedit:2971): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files – Martin Moltke Wozniak Feb 16 '16 at 14:17
  • Looks like an error with the dbus or the service. However I have to admit I lack the skills to help you there any further. It might be a good idea indeed to mark this question as answered and post the script one in a new question so it's easier to find. Remember to post your error as well. Should get an answer today. :-) – BenjB Feb 16 '16 at 14:47
2

This also works: with the -h option:

sudo shutdown -h 17:00 "Shutting down my Linux."

Here is the output:

Broadcast message from maestro@maestro-5567
    (/dev/pts/10) at 15:28 ...

The system is going down for halt in 92 minutes!
Shutting down my Linux. 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.