automatic shutdown

how can program automatic shutdown of my computer? :\ I am using OpenSuse-11.1

A cron job will do it.
crontab -e

Is this overkill? I wrote it because Gnome startup failed for me a couple of times so I thought I’d play safe when shutting down from a cronjob.

# Do a gnome session logout before shutting down.

# The timeout used for this popup is arbitrary.
xmessage -timeout 60 -center -buttons OK:0,Cancel:2 "Power Off PC?"
if  $? == 0 ] ; then

    # Request shutdown _before_ logout commences.
    # Allow enough time for logout to take place.
    # Allow enough time for atd one-minute resolution.
    echo "sudo /sbin/shutdown -h now" | at now+3min

    # Dialog appears with a built-in one minute timeout.
    # Cancelling logout in dialog does not cancel shutdown.
    # Cancelling shutdown with atq/atrm does not require sudo.
    # This script is done as soon as the dialog appears.
    gnome-session-save --kill


# Done.

If you are not experienced user here it is:


KDE3 uses kshutdown,
KDE4 uses kde4-kshutdown
gnome uses gshutdown (it is version 0.2 and I don’t know is it stable enough)

I used

 crontab -e 

it opened an editor, and I typed:

 */5 * * * * /sbin/init 0 

To shutdown my PC 5 minutes after starting up

 man crontab 


 man cron 

;)Thank you very much!!!