Jump to content

Recommended Posts

I would like to insert a process at the point PRIOR to calling 'End Session', i.e. following Menu -> Logout in LE2005. Can anyone tell me where the process/script is, which is called at this stage, or point me to a site where I can read up on how this whole procedure works? Thanks.

Edited by satelliteuser083
Link to comment
Share on other sites

I can tell you three ways that this can be done, but I don't know if these are the best ways. Others may have better ideas.

 

You're dealing with the init process and runlevels here, and there is a set of scripts for each runlevel to start/stop system services, etc. For example, normal startup is to runlevel 5 so scripts in /etc/rc.d/rc5.d are run. Failsafe mode is runlevel 1, so the scripts in /etc/rc.d/rc1.d are run. When the system is halted or rebooted, the runlevel is changed to 0 or 6, so the corresponding scripts in rc0.d or rc6.d are run.

 

For startup, it's easy - you can edit /etc/rc.local to put in your own custom commands. I'm not aware of a corresponding user-level script file for use at shutdown, but you can do one of the following (others may post additional or better options). The first idea below is the easiest and the third is the hardest.

 

1. Take a look at the /etc/rc.d/rc script. Note this code at the bottom:

 

if [[ "$newrunlevel" != "0" && "$newrunlevel" != "6" ]]; then
   rc_splash stop
fi

You can put in your own code after the 'rc_splash stop' line.

 

2. Take a look at /etc/rc.d/rc0.d and /etc/rc.d/rc6.d. These are scripts that involve various system services are run in sequence; e.g., K05keytable -> ../init.d/keytable is run before K09dm -> ../init.d/dm. If what you want to do is associated with one of these various service scripts, you can put your code in that script.

 

3. You can learn about how to create your own scripts in rc0.d and rc6.d and configure the system to run them.

 

References:

http://rute.2038bug.com/node35.html.gz

man init

Link to comment
Share on other sites

jboy: what I THINK I want (I'm simply assuming that this is possible :unsure: ) is actually a stage PRIOR to the one which you describe. In LE2005, when I click on Menu, then Logout, a window appears with the options: 'End Current Session', 'Turn Off Computer', 'Restart Computer' and 'Cancel'. I would like to insert a message-display process BEFORE this window appears, so that the user still has the opportunity to subsequently 'Cancel' if desired. As I understand it (please correct me if I'm wrong) placing this process in rc0.d or rc6.d is too late, because the runlevel has already been set according to the user's decision to 'turn-off' or 'restart'; a 'cancel' is no longer possible.

Link to comment
Share on other sites

Surely if the window has:

 

End Current Session

Turn Off Computer

Restart Computer

Cancel

 

that they can click cancel without having an intermediatary Cancel button before it? I can't understand your need to have one, when a cancel button already exists?

 

The cancel button on this screen works for me, so I don't end up logging out. I don't know why another is required?!?

 

Or are you saying you want a cancel button after this, as a second measure like, are you really really sure you want to shutdown/reboot, etc?

Link to comment
Share on other sites

Me either, from what I can see, you'd need to incorporate it into the desktop manager be it kdm or gdm.

 

For kde, when you log out and get prompted, that is using kdm. When your using gnome, it's gdm. If you use gnome with kdm, it doesn't prompt for options, you only get the logout option. And vice versa with kde, if you have gdm, then you only get a logout option for kde.

 

gdm supplies the options for gnome, and kdm supplies the options for kde. So no real idea on how you could code anything into here. You could try the session manager in kde to see if it has any customisability. I'd check but I'm not on my system right now! :P

Link to comment
Share on other sites

ianw1974 and jboy: I've been into the session manager in kde and it doesn't look as though there is any customisation there, to do what I want. It doesn't look possible to use rc0.d, rc6.d, or rc.local either, probably because at that time X-Window is not (still / yet) running (my assumption!); in any case, I've tried putting a script in both rc6.d and rc.local but nothing happens. Never mind, it would have been useful but is not essential. Many thanks. :thumbs:

Link to comment
Share on other sites

I've been helped with a possibility (by DS2K3 in Linux Help Forums) using Menu--> System--> Configuration--> KDE--> LookNFeel--> System Notifications. You then pick "KDE is exiting" from the drop-down list and click the "More Options" button at the bottom of the window.

That all works with me; however, when I click "Show a message in a pop-up window", not only is there apparently no way of specifying WHICH message is to be shown, but it doesn't work on 'Restart Computer' either. At least, I've not been able to see anything displayed. Most strange :unsure: I'm probably specifying something incorrectly - or perhaps I've just misunderstood this feature's function; any further help would be greatly appreciated.

Edited by satelliteuser083
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...