Help!

Kill process on logout

 
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> SUSE RSS
Next:  VNC setup  
Author Message
cgrossko
External


Since: May 04, 2007
Posts: 4



PostPosted: Fri May 04, 2007 7:56 pm    Post subject: Kill process on logout
Archived from groups: alt>os>linux>suse (more info?)

Hello, I have recently installed some software that does not properly
shutdown when users logoff, so the process hangs and eventually ends
up with 100% usage. I have contacted the company about this and they
are working on a fix in the mean time I want to create a script to
kill the process when users logout. I came up with this so far:

#!/bin/bash -l
/usr/bin/pkill -u $USER 3
/opt/gnome/bin/gnome-session-save --kill

So the users will click on an icon in the tray and it will execute
that script, which works great except when they log back in they get a
X terminal screen presented to them. I have tried putting exit at the
end of the script and also appended it with a | and && to the end of
the gnome-session-save command. Anyhelp would be great.

Thanks,
Cody
Back to top
houghi
External


Since: Apr 25, 2004
Posts: 3549



PostPosted: Sat May 05, 2007 3:04 pm    Post subject: Re: Kill process on logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

cgrossko@wusd.org wrote:
> Hello, I have recently installed some software that does not properly
> shutdown when users logoff, so the process hangs and eventually ends
> up with 100% usage. I have contacted the company about this and they
> are working on a fix in the mean time I want to create a script to
> kill the process when users logout. I came up with this so far:
>
> #!/bin/bash -l
> /usr/bin/pkill -u $USER 3
> /opt/gnome/bin/gnome-session-save --kill
>
> So the users will click on an icon in the tray and it will execute
> that script, which works great except when they log back in they get a
> X terminal screen presented to them. I have tried putting exit at the
> end of the script and also appended it with a | and && to the end of
> the gnome-session-save command. Anyhelp would be great.

Darn, there is a way to say to run a script just before, during or after
logoff. Forgot which one. I have searched but can't find it anymore.
Perhaps me telling this will trigger somebody to tell how t can be done,
so your users do not need to click on a button.

Now about killing the program. As I understand gnome-session-save needs
to be killed. What is the reason to use pkill? Killing the process
should be good enough.

The other thing is the start of 'a X terminal'. I am starting to guess
here, because I have no idea what kind of terminal starts up. I will
also asume that whateve enviroment you use (KDE, GNOME, XFCE, ...) will
behave in the same way as my Windowmaker and the things you click behave
in bthe same way as mine.

If I look in mysettings for the icons, I have two things. One is to
start when Window Maker is started. Whne this is turned on, the program
will be started. I can imagine that something will start a terminal.



houghi
--
At the source of every error which is blamed on the computer you will
find at least two human errors, including the error of blaming it on
the computer.
Back to top
JohnK
External


Since: May 18, 2005
Posts: 66



PostPosted: Sat May 05, 2007 3:04 pm    Post subject: Re: Kill process on logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> Darn, there is a way to say to run a script just before, during or after
> logoff. Forgot which one. I have searched but can't find it anymore.

Put an executable script in ~/.kde/Autostop (which you might have to
create). The script will run when you logout.

Obviously this is a KDE feature so if you use gnome or some other window
manager then you'll need to find their equivalent.

JohnK
Back to top
JohnK
External


Since: May 18, 2005
Posts: 66



PostPosted: Sat May 05, 2007 3:16 pm    Post subject: Re: Kill process on logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

JohnK wrote:
>> Darn, there is a way to say to run a script just before, during or after
>> logoff. Forgot which one. I have searched but can't find it anymore.
>
> Put an executable script in ~/.kde/Autostop (which you might have to
> create). The script will run when you logout.
>
> Obviously this is a KDE feature so if you use gnome or some other window
> manager then you'll need to find their equivalent.
>
> JohnK

Sorry, the above is wrong... your scripts should actually be put in
~/.kde/shutdown

Seems a bit inconsistent with the Autostart directory but..

JohnK
Back to top
Theo v. Werkhoven
External


Since: Mar 26, 2005
Posts: 181



PostPosted: Sat May 05, 2007 3:30 pm    Post subject: Re: Kill process on logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The carbonbased lifeform houghi inspired alt.os.linux.suse with:
> cgrossko@wusd.org wrote:
>> Hello, I have recently installed some software that does not properly
>> shutdown when users logoff, so the process hangs and eventually ends
>> up with 100% usage. I have contacted the company about this and they
>> are working on a fix in the mean time I want to create a script to
>> kill the process when users logout. I came up with this so far:
>>
>> #!/bin/bash -l
>> /usr/bin/pkill -u $USER 3
>> /opt/gnome/bin/gnome-session-save --kill
>>
>> So the users will click on an icon in the tray and it will execute
>> that script, which works great except when they log back in they get a
>> X terminal screen presented to them. I have tried putting exit at the
>> end of the script and also appended it with a | and && to the end of
>> the gnome-session-save command. Anyhelp would be great.
>
> Darn, there is a way to say to run a script just before, during or after
> logoff. Forgot which one. I have searched but can't find it anymore.
> Perhaps me telling this will trigger somebody to tell how t can be done,
> so your users do not need to click on a button.

~/.bash-logout

Theo
--
theo at van-werkhoven.nl ICQ:277217131 SuSE Linux
linuxcounter.org: 99872 Jabber:muadib at jabber.xs4all.nl AMD XP3000+ 1024MB
"ik _heb_ niets tegen Microsoft, ik heb iets tegen
de uitwassen *van* Microsoft"
Back to top
cgrossko
External


Since: May 04, 2007
Posts: 4



PostPosted: Mon May 07, 2007 12:09 pm    Post subject: Re: Kill process on logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On May 5, 3:30 am, "Theo v. Werkhoven"
wrote:
> The carbonbased lifeform houghi inspired alt.os.linux.suse with:
>
>
>
> > cgros...@wusd.org wrote:
> >> Hello, I have recently installed some software that does not properly
> >> shutdown when users logoff, so the process hangs and eventually ends
> >> up with 100% usage. I have contacted the company about this and they
> >> are working on a fix in the mean time I want to create a script to
> >> kill the process when users logout. I came up with this so far:
>
> >> #!/bin/bash -l
> >> /usr/bin/pkill -u $USER 3
> >> /opt/gnome/bin/gnome-session-save --kill
>
> >> So the users will click on an icon in the tray and it will execute
> >> that script, which works great except when they log back in they get a
> >> X terminal screen presented to them. I have tried putting exit at the
> >> end of the script and also appended it with a | and && to the end of
> >> the gnome-session-save command. Anyhelp would be great.
>
> > Darn, there is a way to say to run a script just before, during or after
> > logoff. Forgot which one. I have searched but can't find it anymore.
> > Perhaps me telling this will trigger somebody to tell how t can be done,
> > so your users do not need to click on a button.
>
> ~/.bash-logout
>
> Theo
> --
> theo at van-werkhoven.nl ICQ:277217131 SuSE Linux
> linuxcounter.org: 99872 Jabber:muadib at jabber.xs4all.nl AMD XP3000+ 1024MB
> "ik _heb_ niets tegen Microsoft, ik heb iets tegen
> de uitwassen *van* Microsoft"

I tried the .bash_logout and the .logout with no sucess, also I am
using gnome.

Thanks for all the suggestions!
Back to top
cgrossko
External


Since: May 04, 2007
Posts: 4



PostPosted: Mon May 07, 2007 12:49 pm    Post subject: Re: Kill process on logout [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On May 7, 9:09 am, cgros...@wusd.org wrote:
> On May 5, 3:30 am, "Theo v. Werkhoven"
> wrote:
>
>
>
> > The carbonbased lifeform houghi inspired alt.os.linux.suse with:
>
> > > cgros...@wusd.org wrote:
> > >> Hello, I have recently installed some software that does not properly
> > >> shutdown when users logoff, so the process hangs and eventually ends
> > >> up with 100% usage. I have contacted the company about this and they
> > >> are working on a fix in the mean time I want to create a script to
> > >> kill the process when users logout. I came up with this so far:
>
> > >> #!/bin/bash -l
> > >> /usr/bin/pkill -u $USER 3
> > >> /opt/gnome/bin/gnome-session-save --kill
>
> > >> So the users will click on an icon in the tray and it will execute
> > >> that script, which works great except when they log back in they get a
> > >> X terminal screen presented to them. I have tried putting exit at the
> > >> end of the script and also appended it with a | and && to the end of
> > >> the gnome-session-save command. Anyhelp would be great.
>
> > > Darn, there is a way to say to run a script just before, during or after
> > > logoff. Forgot which one. I have searched but can't find it anymore.
> > > Perhaps me telling this will trigger somebody to tell how t can be done,
> > > so your users do not need to click on a button.
>
> > ~/.bash-logout
>
> > Theo
> > --
> > theo at van-werkhoven.nl ICQ:277217131 SuSE Linux
> > linuxcounter.org: 99872 Jabber:muadib at jabber.xs4all.nl AMD XP3000+ 1024MB
> > "ik _heb_ niets tegen Microsoft, ik heb iets tegen
> > de uitwassen *van* Microsoft"
>
> I tried the .bash_logout and the .logout with no sucess, also I am
> using gnome.
>
> Thanks for all the suggestions!

Ok, I found the directory /etc/opt/gnome/gdm/PostSession directory
with a file named Default in it, in this file contained the following
line:

exec /etc/X11/xdm/Xreset

So i added a line to kill the process (3).

And it works!
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> SUSE All times are: Eastern Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum