I'd assumed that the apps started by cinnamon when I logged in would also be killed when I logged out. That doesn't seem to be the case for non-X11 programs that hang around forever and watch files. Those programs just get passed off to PID 1 when one logs out and continue on their merry way till the system reboots. If one logs in again, another instance of the program is started.
The exact program I'm running is a IMAP watcher that watches my remote INBOX and grabs the new mail as soon as it arrives. It would be good if it stopped when I logged out.
/usr/bin/getmail --idle=INBOX
Any ideas? Do I have to keep track of the PID myself and find a logout hook to hang a kill -HUP onto? Does .bash_logout or .logout even get called?
-wolfgang
On 05/12/14 00:52, Wolfgang S. Rupprecht wrote:
I'd assumed that the apps started by cinnamon when I logged in would also be killed when I logged out. That doesn't seem to be the case for non-X11 programs that hang around forever and watch files. Those programs just get passed off to PID 1 when one logs out and continue on their merry way till the system reboots. If one logs in again, another instance of the program is started.
The exact program I'm running is a IMAP watcher that watches my remote INBOX and grabs the new mail as soon as it arrives. It would be good if it stopped when I logged out.
/usr/bin/getmail --idle=INBOX
Any ideas? Do I have to keep track of the PID myself and find a logout hook to hang a kill -HUP onto? Does .bash_logout or .logout even get called?
-wolfgang
In your .bash_logout file you could place a "killall" statement and name the process you want to kill off. See the killall man page.
Ed Greshko ed.greshko@greshko.com writes:
In your .bash_logout file you could place a "killall" statement and name the process you want to kill off. See the killall man page.
Are you seeing .bash_logout called when you exit a desktop session? I don't, but then our setups might differ a bit. (I'm using f20 w. cinnamon)
As an aside, doing it cleanly from .bash_logout would be a bit tricky because I wouldn't want it run when any ssh or tty based logout happened, only when the logout was from the GUI session that started the apps.
-wolfgang
On 05/12/14 06:42, Wolfgang S. Rupprecht wrote:
Ed Greshko ed.greshko@greshko.com writes:
In your .bash_logout file you could place a "killall" statement and name the process you want to kill off. See the killall man page.
Are you seeing .bash_logout called when you exit a desktop session? I don't, but then our setups might differ a bit. (I'm using f20 w. cinnamon)
Humm.... It has been a *long* time since I've tried that. I could swear the last time I had it working....
As an aside, doing it cleanly from .bash_logout would be a bit tricky because I wouldn't want it run when any ssh or tty based logout happened, only when the logout was from the GUI session that started the apps.
I was thinking of checking for the existence of a "DISPLAY" environment variable to avoid that.
But, if .bash_logout isn't effective on GUI logout my idea is worthless.
On 05/12/14 00:52, Wolfgang S. Rupprecht wrote:
Any ideas? Do I have to keep track of the PID myself and find a logout hook to hang a kill -HUP onto? Does .bash_logout or .logout even get called?
FWIW, I know you're running cinnamon, I just had to go back and figure out what I did several fedora versions ago to kill off a program in a similar situation. I knew that I did it....but my memory hadn't kicked yet.
I use KDE and KDE has a directory called /etc/kde/shutdown where you can place scripts to run on logout.
On 05/12/14 07:16, Ed Greshko wrote:
On 05/12/14 00:52, Wolfgang S. Rupprecht wrote:
Any ideas? Do I have to keep track of the PID myself and find a logout hook to hang a kill -HUP onto? Does .bash_logout or .logout even get called?
FWIW, I know you're running cinnamon, I just had to go back and figure out what I did several fedora versions ago to kill off a program in a similar situation. I knew that I did it....but my memory hadn't kicked yet.
I use KDE and KDE has a directory called /etc/kde/shutdown where you can place scripts to run on logout.
I found this for gnome/gdm. Maybe it will be useful for you if you use gdm?
http://www.linuxquestions.org/questions/linux-desktop-74/gnome-run-script-on...
Ed Greshko ed.greshko@greshko.com writes:
I found this for gnome/gdm. Maybe it will be useful for you if you use gdm?
http://www.linuxquestions.org/questions/linux-desktop-74/gnome-run-script-on...
I may have to do that. Thanks.
Strikes me as an oversight that one has to hack a file together and install that with root privs. Whatever is starting the apps really should kill it too.
-wolfgang
On 05/12/14 07:39, Wolfgang S. Rupprecht wrote:
Ed Greshko ed.greshko@greshko.com writes:
I found this for gnome/gdm. Maybe it will be useful for you if you use gdm?
http://www.linuxquestions.org/questions/linux-desktop-74/gnome-run-script-on...
I may have to do that. Thanks.
Welcome. Sorry to take the round-about path to a solution.
Strikes me as an oversight that one has to hack a file together and install that with root privs. Whatever is starting the apps really should kill it too.
I don't use "getmail" but maybe it is thought that this would be a good program to keep running in the background so that the next time you login all your email is already downloaded to your local store?
On 11/05/14 18:52, Wolfgang S. Rupprecht wrote:
I'd assumed that the apps started by cinnamon when I logged in would also be killed when I logged out. That doesn't seem to be the case for non-X11 programs that hang around forever and watch files. Those programs just get passed off to PID 1 when one logs out and continue on their merry way till the system reboots. If one logs in again, another instance of the program is started.
The exact program I'm running is a IMAP watcher that watches my remote INBOX and grabs the new mail as soon as it arrives. It would be good if it stopped when I logged out.
/usr/bin/getmail --idle=INBOX
Any ideas? Do I have to keep track of the PID myself and find a logout hook to hang a kill -HUP onto? Does .bash_logout or .logout even get called?
-wolfgang
I am not sure but it could be systemd-logind; try editing /etc/systemd/logind.conf and change:
#KillUserProcesses=no
to KillUserProcesses=yes
then reboot the system or restart systemd-logind.service.
(Check the logind.conf manual page for more details).
Ahmad Samir ahmadsamir3891@gmail.com writes:
On 11/05/14 18:52, Wolfgang S. Rupprecht wrote:
I'd assumed that the apps started by cinnamon when I logged in would also be killed when I logged out. That doesn't seem to be the case for non-X11 programs that hang around forever and watch files. Those programs just get passed off to PID 1 when one logs out and continue on their merry way till the system reboots. If one logs in again, another instance of the program is started.
I am not sure but it could be systemd-logind; try editing /etc/systemd/logind.conf and change:
#KillUserProcesses=no
to KillUserProcesses=yes
Thanks! That is a great find. I'll try.
-wolfgang
On 5-12-14 11:21:51 Ahmad Samir wrote:
On 11/05/14 18:52, Wolfgang S. Rupprecht wrote:
I'd assumed that the apps started by cinnamon when I logged in would also be killed when I logged out. That doesn't seem to be the case for non-X11 programs that hang around forever and watch files.
I am not sure but it could be systemd-logind; try editing /etc/systemd/logind.conf and change:
#KillUserProcesses=no
to KillUserProcesses=yes
then reboot the system or restart systemd-logind.service.
(Check the logind.conf manual page for more details).
Although this may very well be the solution that Wolfgang is looking for, I suspect that there will be a more fine-grained option evolving sometime in the future. The problem is, how do you kill the programs you want killed off upon logout without killing something like screen(1)?
On 05/15/14 11:27, Garry T. Williams wrote:
On 5-12-14 11:21:51 Ahmad Samir wrote:
On 11/05/14 18:52, Wolfgang S. Rupprecht wrote:
I'd assumed that the apps started by cinnamon when I logged in would also be killed when I logged out. That doesn't seem to be the case for non-X11 programs that hang around forever and watch files.
I am not sure but it could be systemd-logind; try editing /etc/systemd/logind.conf and change:
#KillUserProcesses=no
to KillUserProcesses=yes
then reboot the system or restart systemd-logind.service.
(Check the logind.conf manual page for more details).
Although this may very well be the solution that Wolfgang is looking for, I suspect that there will be a more fine-grained option evolving sometime in the future. The problem is, how do you kill the programs you want killed off upon logout without killing something like screen(1)?
Well, the 2 "display manager" specific options mentioned earlier, which run scripts that can be tailored to individual needs, would seem to fit that bill.