Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want close the gnome session and shutdown the computer when the downloads finish but I want to show the shutdown window to can cancel it in some cases.
I use: gnome-session-quit --power-off --force but this doesn't work when the screen is in suspend mode. Is this a bug or the normal behavior? In Gnome 2 this worked well even the screen is off.
Any idea?

share|improve this question

2 Answers 2

you can type shutdown --help in a terminal to see various options

shutdown --help
Usage: shutdown [OPTION]... TIME [MESSAGE]
Bring the system down.

Options:
  -r                          reboot after shutdown
  -h                          halt or power off after shutdown
  -H                          halt after shutdown (implies -h)
  -P                          power off after shutdown (implies -h)
  -c                          cancel a running shutdown
  -k                          only send warnings, don't shutdown
  -q, --quiet                 reduce output to errors only
  -v, --verbose               increase output to include informational messages
      --help                  display this help and exit
      --version               output version information and exit

TIME may have different formats, the most common is simply the word 'now' which will bring the system down immediately. Other valid formats are +m, where m is the number of minutes to wait until shutting down and hh:mm which specifies the time on the 24hr clock.

Logged in users are warned by a message sent to their terminal, you may include an optional MESSAGE included with this. Messages can be sent without actually bringing the system down by using the -k option.

If TIME is given, the command will remain in the foreground until the shutdown occurs. It can be cancelled by Control-C, or by another user using the -c option.

The system is brought down into maintenance (single-user) mode by default, you can change this with either the -r or -h option which specify a reboot or system halt respectively. The -h option can be further modified with -H or -P to specify whether to halt the system, or to power it off afterwards. The default is left up to the shutdown scripts.

to make run you will need sudo shutdown now for instance will shut the computer down right away.

hope this helps.

share|improve this answer
    
ok, but "...I want to show the shutdown window to can cancel it in some cases." The shutdown command (I knew it) shows nothing to alert the user of the shutdown. –  Simón Jan 23 '12 at 13:39
    
there is this that is helpful stackoverflow.com/questions/526329/… i was just checking but other than this i haven't seen of a gui that does this! let me know if you find one :-) cheers –  bmbaker Jan 23 '12 at 14:50

Well, I'm pretty sure that this is a gnome bug with gnome-session-quit.
While they solve it I've created a script to do this:

yad --text-info --title LFTP --text='<b>El sistema procederá a apagarse en unos segundos...</b>' --image=/home/simon/.local/share/icons/lftp.png --image-on-top --timeout=10 --timeout-indicator=bottom --on-top --center --button=gtk-cancel:0 --window-icon=/home/simon/.local/share/icons/lftp.png || sudo shutdown -h now

I use yad (a fork of Zenity) to show the alert.

share|improve this answer
    
hmmm this looks interesting i play with this later :-) –  bmbaker Jan 25 '12 at 22:41

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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