LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-27-2003, 02:53 AM   #1
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Rep: Reputation: 30
Question 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:25nce:/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?
 
Old 08-28-2003, 07:46 AM   #2
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Original Poster
Rep: Reputation: 30
not many people know very much about X questions.
 
Old 08-28-2003, 11:05 AM   #3
mexifries
LQ Newbie
 
Registered: Aug 2003
Location: ATL GA
Distribution: slack 10
Posts: 7

Rep: Reputation: 0
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
 
Old 08-29-2003, 02:21 AM   #4
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Original Poster
Rep: Reputation: 30
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.
 
Old 08-29-2003, 02:32 AM   #5
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Original Poster
Rep: Reputation: 30
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.
 
Old 08-29-2003, 05:35 AM   #6
andrewlkho
Member
 
Registered: Jul 2003
Location: London
Posts: 548

Rep: Reputation: 30
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.
 
Old 08-29-2003, 06:25 AM   #7
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Original Poster
Rep: Reputation: 30
i sorted it by adding killall5 -15 and -9 into the halt and reboot scripts.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems shutting down FC4 MurX Linux - Hardware 7 10-31-2005 03:10 AM
problems shutting down wisdom Mandriva 4 02-26-2004 02:58 AM
problems shutting down the computer. schatoor Linux - General 17 01-06-2004 11:08 PM
Please help in shutting down problems ShaneH Linux - Newbie 4 09-26-2003 10:13 AM
problems shutting down X schatoor Linux - General 7 10-02-2002 05:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration