Results 1 to 3 of 3

Thread: To shut down or reboot computer on timer

  1. #1
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,048
    Distro
    Ubuntu 16.04 Xenial Xerus

    To shut down or reboot computer on timer

    Many of you know this stuff but others do not so here


    first so you do not have to enter password each time


    Code:
    sudo gedit /etc/sudoers
    then add both lines at bottom of document and save

    Code:
    #includedir /etc/sudoers.d
    username ALL=NOPASSWD: /sbin/halt
    Code:
    #includedir /etc/sudoers.d
    username ALL=NOPASSWD: /sbin/shutdown

    =============================================


    NOW you can enter
    Code:
    sudo halt
    to turn off computer
    or
    Code:
    sudo reboot
    to reboot


    ============================================

    But the good stuff is using the timer


    Code:
    sudo shutdown -h 08:48
    will shut you down at 8:48
    Code:
    sudo shutdown -r 18:49
    will reboot you at 18:49


    Further options found with
    Code:
    shutdown --help

    ===========================================


    It means you start a download & ask your computer to shutdown 3 hours later for example
    Last edited by shantiq; September 18th, 2011 at 05:09 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu community ... exchanging tips to make things better .... The World should take heed :]
    ShanArt

  2. #2
    Join Date
    Jul 2005
    Location
    England
    Beans
    Hidden!

    Re: To shut down or reboot computer on timer

    There is no need to edit the sudoers file to do any of that. Just issue those commands, eg
    Code:
    sudo shutdown -h 08:25
    enter password when needed, then minimise the terminal, and shutdown will happen at 8:25, just as in your example. You can even set up launchers for "application run in terminal" on your desktop if you want to.

    Note also that to enter a time in the 24 hr time system you do not need the + that you have added; that is used for a shutdown/reboot at the current time +# minutes, not the specific time you show, though it does not seem to cause a problem if the + is also used.

    I don't see why having to enter a password for this is such a problem.
    Last edited by ajgreeny; September 18th, 2011 at 11:17 AM.
    DISTRO: Xubuntu 14.04-64bit --- Code-tags --- Boot-Repair --- Grub2 wiki & Grub2 Basics --- RootSudo

  3. #3
    Join Date
    Jul 2009
    Location
    Hippiesoldierstan
    Beans
    2,048
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: To shut down or reboot computer on timer

    thanx for input greeny
    was not aware of the + not being needed
    will modify in post above



    as regards the password well it is mostly if one manipulates this stuff in a script there is no request for password.

    see example here where one would be asked for password if this was not set up and task would therefore not be completed
    Last edited by shantiq; September 18th, 2011 at 05:09 PM.
    Linux is Latin for off-the-beaten-track
    what I like MOST about our Ubuntu community ... exchanging tips to make things better .... The World should take heed :]
    ShanArt

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •