27 lines
550 B
Bash
Executable File
27 lines
550 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# This script will reset x2go sessions to a working state
|
|
# Copyright 2021 Bryan C. Roessler
|
|
|
|
[[ -f functions ]] && . functions || exit 1
|
|
|
|
is_root
|
|
|
|
[[ $# -lt 1 ]] && echo "No username provided!" && exit 1
|
|
[[ $# -ge 1 ]] && user="$1"
|
|
|
|
|
|
# Clean local user cache
|
|
rm -rf /home/"$user"/.x2go/C-"$user"-*
|
|
|
|
mapfile -t sessions < <(x2golistsessions_root | grep "$user")
|
|
|
|
for session in "${sessions[@]}"; do
|
|
id=${session%|*}
|
|
x2goterminate-session "$id"
|
|
done
|
|
|
|
exit=$?
|
|
|
|
echo "X2Go sessions for user $user have been reset"
|
|
|
|
exit $exit |