I want my computer to be turned off every day at 21:30. How do I do this?

I found this command:

sudo shutdown -h 21:30 

Is this correct?

With this I have to have the terminal open all the time. I read that I also can run it in the background so I don't have to have the terminal open all the time. How do I do this?

If I don´t have to run it in the background, what else do I have to do?

  • You can setup a cron job.
    – Pilot6
    Nov 3 '16 at 10:31
  • How do I do that? I just a beginner with ubuntu. Nov 3 '16 at 10:36
  • You can search "how to setup a cron job".
    – Pilot6
    Nov 3 '16 at 10:37

you can use this;

open cron file;

sudo -H gedit /etc/crontab

add below end of line

30 21 * * * root shutdown -h now
  • I think it works. But when I try to change the time to test it now I get: ** (gedit:5144): WARNING **: Set document metadata failed: Instellen van attribuut metadata::gedit-spell-enabled is niet mogelijk Nov 3 '16 at 10:52
  • Sorry, but still does not work. Really I have no clue what I am doing so please help me. When I put in the code and wanted to close the terminal, the code was gone. Nov 3 '16 at 11:11

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.