Update script-user-reset-x2go
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
// Copyright 2021 Bryan C. Roessler
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#!/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
|
||||
Reference in New Issue
Block a user