Results 1 to 7 of 7

Thread: Gksudo gives a Usage Error with options

  1. #1
    Join Date
    Feb 2011
    Beans
    3

    Gksudo gives a Usage Error with options

    I'm trying to have my system shutdown at specified times. To do this I would use a crontab and gksudo, but there's a problem. I want to halt my system after the fact so I've been trying this:
    Code:
    gksudo -S shutdown -h now
    The problem is with the -h option, since it works without it.

    Thanks for the help!


    Ubuntu x64
    Intel Core 2 Duo @ 2.3 Ghz

  2. #2
    Join Date
    Dec 2010
    Location
    Sweden
    Beans
    Hidden!

    Re: Gksudo gives a Usage Error with options

    Quote Originally Posted by DocWho27 View Post
    I'm trying to have my system shutdown at specified times. To do this I would use a crontab and gksudo, but there's a problem. I want to halt my system after the fact so I've been trying this:
    Code:
    gksudo -S shutdown -h now
    The problem is with the -h option, since it works without it.

    Thanks for the help!


    Ubuntu x64
    Intel Core 2 Duo @ 2.3 Ghz
    I noticed that you use "gksudo" for your

    command which should only be used for graphical applications.

    Since you're trying to run a "non gui" terminal application,

    use "sudo".

    Do this instead:

    Code:
    sudo shutdown -h now
    Do you know that you can schedule a shutdown

    at a specific time(without using cron) by doing for example:

    Code:
    sudo shutdown -h 12:00
    Then the computer would shutdown at 12:00am.
    Last edited by DanneStrat; February 25th, 2011 at 08:11 PM.

  3. #3
    Join Date
    Jun 2007
    Location
    Paraparaumu, New Zealand
    Beans
    Hidden!

    Re: Gksudo gives a Usage Error with options

    I noticed you'd used gksudo too. Please have a look here: https://help.ubuntu.com/community/RootSudo
    Forum DOs and DON'Ts
    Please use CODE tags
    Including your email address in a post is not recommended
    My Blog

  4. #4
    Join Date
    Feb 2011
    Beans
    3

    Re: Gksudo gives a Usage Error with options

    I do know that I can schedule a single shutdown at any specified time, but I want to have my system shut down every every night on it's own (more or less).

    There is a good chance that I won't have a terminal open open at the time specified, so I chose to use gksudo.

    I guess any app that runs advanced power management (such as hibernate & shutdown at specified times) would be another answer to what I'm looking for.

  5. #5
    Join Date
    Dec 2010
    Location
    Sweden
    Beans
    Hidden!

    Re: Gksudo gives a Usage Error with options

    Quote Originally Posted by DocWho27 View Post
    I do know that I can schedule a single shutdown at any specified time, but I want to have my system shut down every every night on it's own (more or less).

    There is a good chance that I won't have a terminal open open at the time specified, so I chose to use gksudo.

    I guess any app that runs advanced power management (such as hibernate & shutdown at specified times) would be another answer to what I'm looking for.
    You can do the following:

    Install "gnome-schedule" from the repositories.

    You want to make a scheduled task

    to shut down your computer.

    The "shutdown" command requires

    elevated privilegies so you have to start

    gnome-schedule with "gksudo".

    Open a terminal and run:

    Code:
    gksudo gnome-schedule
    Make a new scheduled task to run every

    day and set the time you want.

    In the "command" box type the following:

    Code:
    /sbin/shutdown -h now
    Now go ahead and apply the new task.

    Let me know if it works.
    Last edited by DanneStrat; February 26th, 2011 at 01:01 PM.

  6. #6
    Join Date
    Feb 2011
    Beans
    3

    Re: Gksudo gives a Usage Error with options

    Thanks! That helped a bunch!

    I ran into a slight snag with trying to save unsaved documents, but I found gnome-session-save --logout and that should do the trick. Just need to write a script that runs session-save and then shutdown.

    Thanks again!

  7. #7
    Join Date
    Dec 2010
    Location
    Sweden
    Beans
    Hidden!

    Re: Gksudo gives a Usage Error with options

    Quote Originally Posted by DocWho27 View Post
    Thanks! That helped a bunch!

    I ran into a slight snag with trying to save unsaved documents, but I found gnome-session-save --logout and that should do the trick. Just need to write a script that runs session-save and then shutdown.

    Thanks again!
    Alright!

    Good luck!

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
  •