View Single Post
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#3
Code:
#!/bin/sh
if [ `id -u` != 0 ] ; then
#if not already root, call itself as root
        exec sudo gainroot <<EOF
exec $0 $*
EOF
        exit $?
fi
#real script follows
reboot
Thanks to fanoush.

EDIT: It may just be easier to use this; which can be run as user:
Code:
dbus-send --system --type=method_call --dest="com.nokia.mce" --print-reply "/com/nokia/mce/request" com.nokia.mce.request.req_reboot

Last edited by qwerty12; 2008-06-27 at 09:05.
 

The Following User Says Thank You to qwerty12 For This Useful Post: