I do not whether it is a bug or not. I add several bash scripts at "application autostart" of "session startup", they poll the computer in minute/hour and perform some maintenance stuff. When i logout xfce, i found out that they are not killed. I checked that their parent process id are always 1 (the linux process "init") instead of xfce4-session it is expected bahviour of xfce? acutally i expect program should get killed when logout by default, except run by "nohup" command
I see a lot of processes started by XFCE session have parent PID 1. Both internal XFCE tools and XDG-autostarted apps. Shouldn't they have startxfce4 or something like that as a parent process?
I'm also wondering about this. I have a wallpaper changer which changes background every 5 minutes. This does not get killed at logoff and a second instance is created at new login. In Gnome these processes were owned by gnome-session and got automatically killed. But not so with Xfce, here they are owned by init and running forever. How can I assure that such processes get killed at logoff?
As a workaround I use a script derived from fbpanel xlogout script. It finds session manager PID and prints it to stdout. There is also a function to exit. You can test if session is still exist and terminate your script if it is ended. See info here: https://bbs.archlinux.org/viewtopic.php?pid=1179199#p1179199 script: -------------- #!/bin/bash getsessionpid(){ # got this from fbpanel xlogout script, refined. # find PID of session manager process to exit when it no longer exists # get display number DPY=$(echo $DISPLAY | cut -d ':' -f 2) # get X pid XPID=$(echo $(< /tmp/.X${DPY}-lock)) # get pid of xdm (or gdm, kdm, simple xinitrc, etc). usually it's parent of X XDMPID=$(ps -o ppid --no-headers --pid=$XPID) # recursivly find child of xdm that was started in home dir - # it's user's session start up script pid_scan(){ unset XDMCHILDREN while [ $# != 0 ]; do XDMCHILDREN="$XDMCHILDREN $(ps --no-headers -o pid --ppid=$1)" shift done for pid in $XDMCHILDREN; do if cwd=$(ls -al /proc/$pid/cwd 2>/dev/null); then cwd=`sed 's/.*-> //' <<< $cwd` [ "$cwd" = "$HOME" ] && echo $pid && return fi done pids=$XDMCHILDREN [ -n "$pids" ] && pid_scan $XDMCHILDREN; } SESSIONPID=`pid_scan $XDMPID` [ -z "$SESSIONPID" ] && echo "No session parent found" >&2 && false [ -n "$SESSIONPID" ] && echo $SESSIONPID } exit-with-session(){ ps -eo pid | grep -qw $SESSIONPID || exit 0 } getsessionpid --------------
Thank you for that link. Works great. I now use the script in your link to get the pid of the session manager. Then I test in my Python script if it still exists, and exit if not.
*** This bug has been marked as a duplicate of bug 15368 ***