shutting down problems
I have a perl/Tk program running in X which has a shutdown button. If
i startx and run said button it shuts down X and shuts down my box nice and cleanly. If i have the respawn option set in my inittab like so: # The default runlevel. id:2:initdefault: # System initialization. si:2:sysinit:/rc.init mi:2:wait:/etc/rcS # Things to run in every runlevel. ud:25:once:/sbin/update # Start X co:2:respawn:/bin/su user -c /bin/xstart l0:0:wait:/etc/init.d/halt l6:6:wait:/etc/init.d/reboot It will reboot albeit not cleanly at all and leaves the /tmp/.X0-lock behind. if i set the button to do a shutdown -h now it halts but X doesnt shutdown, this method is also unclean and leaves the horrible lock file behind. Anyone know why this is happening? I thought the shutdown command changes the runlevel? |
not many people know very much about X questions. :(
|
hey man sup? that's cool man i didn't even think abt running the /rc.d/ runlevel thingamajigs to shutdown...
but lemme tell you what i do that works perfect.. i've got fluxbox and i start automatically into runlevel 4 (i use slack so it might be 5 for you)... and i have gdm log my wheel user "me" in automatically, so my box actually starts like windows.. and just as fast, too! now the tricky part for me was being able to shut down & reboot with a click of the button, like windows.. and we know doing work as root all the time is evil.. and regular users can't reboot and shut down.. only root.. so in the end, i added "me" to the sudoers file & made the buttons run "sudo /sbin/reboot" & "sudo /sbin/halt".... and that does all you need to do! exits X gracefully & shuts down cleanly :) |
what about setuid'ing a perl script that calls the shutdown command (which is what i do)?
like i said what seems to happen is it DOES go to runlevel 0 (halt) and it DOES halt, but the X session doesnt close. |
the shutdown command works by using INIT in the same way CTRL-ALT-DEL does and both of those work only in console mode. So i am thinking that the only way this will work properly is by switching to console first THEN running shutdown.
|
hm...well I have a script that is quite simply:
#!/bin/bash sudo shudown -h now and that seems to work fine, even when run from X. |
i sorted it by adding killall5 -15 and -9 into the halt and reboot scripts.
|
All times are GMT -5. The time now is 04:14 AM. |