[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running jobs at shutdown



On Wed, Oct 20, 2004 at 12:50:18AM +0200, Magnus Therning wrote:
> Currently I have a few jobs I run at boot time using @reboot in my
> crontab. I would really like to be able to run some jobs just before
> shutting down as well (alternatively when I log out of GNOME). How can I
> do that?

To run them when you log out, you can put them in your ~/.xsession

    #!/bin/sh
    gnome-session
    ~/bin/job-to-run-after-logout 1
    ~/bin/job-to-run-after-logout 2

This will run the jobs after you log out of gnome. The jobs will still
ahve access to the X display - but there won't be any window manager
at this stage. 

The display manager won't return until the jobs are finished (unless you
start the jobs in the background, and then they cannot rely on access
to the the X display).

PS: This assume that you actually use ~/.xsession - iirc you can tell GDM
    to login as "X session" rather than the default gnome-session.

Hope this helps
-- 
Karl E. Jørgensen
karl@jorgensen.com   http://karl.jorgensen.com
==== Today's fortune:
There's no saint like a reformed sinner.

Attachment: signature.asc
Description: Digital signature


Reply to: