This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 20721402b13178336564e1e1355f1cf93420d547 Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Fri Aug 13 09:47:04 2021 -0500 x2goterminate-session: terminate x2goruncommand and all processes from the group. --- debian/changelog | 2 ++ x2goserver/bin/x2goruncommand | 4 ++++ x2goserver/bin/x2goterminate-session | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index 8cd85461..852ecb84 100644 --- a/debian/changelog +++ b/debian/changelog @@ -456,6 +456,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium * New upstream version (4.1.0.4): - Add support for X2Go KDrive. - x2goruncommand: start Xsession on X2Go KDrive desktops. + - x2goterminate-session: terminate x2goruncommand and all processes + from the group. [ Tom Ruzicka ] * debian/po: Add Czech debconf translation. diff --git a/x2goserver/bin/x2goruncommand b/x2goserver/bin/x2goruncommand index 5a553043..13a93fab 100755 --- a/x2goserver/bin/x2goruncommand +++ b/x2goserver/bin/x2goruncommand @@ -46,8 +46,12 @@ args='' X2GO_ROOT="${HOME}/.x2go" MESSAGE_FILE="$X2GO_ROOT/C-$X2GO_SESSION/cmdoutput" +PID_FILE="$X2GO_ROOT/C-$X2GO_SESSION/cmd.pid" echo "exec $cmd" >> "$MESSAGE_FILE" +#save x2goruncommand pid +echo -n "$$" > "$PID_FILE" + # make Kerberos's ticket cache known inside the X2Go session test -n $KRB5CCNAME && export KRB5CCNAME diff --git a/x2goserver/bin/x2goterminate-session b/x2goserver/bin/x2goterminate-session index 64125436..3afd49db 100755 --- a/x2goserver/bin/x2goterminate-session +++ b/x2goserver/bin/x2goterminate-session @@ -35,6 +35,8 @@ if [ -z $SESSION_NAME ]; then fi X2GO_ROOT="${HOME}/.x2go" +PID_FILE="$X2GO_ROOT/C-$SESSION_NAME/cmd.pid" + X2GO_LIB_PATH="$(x2gopath libexec)"; @@ -42,6 +44,7 @@ $X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" X2GO_AGENT_PID=`$X2GO_LIB_PATH/x2gogetagent "$SESSION_NAME"` X2GO_AGENT_PID=`echo "$X2GO_AGENT_PID"| awk {'print $1'}` +X2GO_CMD_PID=`cat $PID_FILE` # stop x2godesktopsharing process gracefully... x2gofeature X2GO_DESKTOPSHARING &>/dev/null && x2goterminate-desktopsharing "$SESSION_NAME" || true @@ -49,6 +52,9 @@ x2gofeature X2GO_DESKTOPSHARING &>/dev/null && x2goterminate-desktopsharing "$SE # run x2goserver-extensions for pre-terminate x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" pre-terminate || true +#terminate x2goruncommand process and all processes from group +kill -- -$X2GO_CMD_PID + if kill -TERM $X2GO_AGENT_PID &>/dev/null; then $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "session with ID "$SESSION_NAME" has been terminated successfully" -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git