Re: to run a "interactive" scritp before shutting down the system
On Dec 7, 2006, at 4:51 AM, Godofredo Fdez. Requena wrote:
El Jueves 07 Diciembre 2006 11:51, Grzegorz escribió:
did you consider creating init script, which would be executed at
switching to runlevels 0 (poweroff) and 6 (reboot)???
see `man update-rc.d` and /etc/init.d/skeleton (sample script)
kde has graphical manager to init scripts: ksysv
OK, I have already tested this option but it has two "problems":
1.- I only want that a "specific user" of the system runs the
script, if I
put this script in runlevel0 every user of the system should "talk
Check the environment for what user is calling the script, from
inside the script, and die if it's not the "authorized" user.
if [ `/usr/bin/whoami` != "bob" ] ; then
echo This program must be run as user *bob*!
2.- The script have to be executed by "this specific user" not by
avoid security problems.
sudo could handle this.