Veja x2golistsessions_root
aqui está um script que eu escrevi:
LIMIT_DAYS=12
for ll in 'x2golistsessions_root'; do
#Get the date of last use of the session
lastd='echo $ll | awk -F \| '{print }' | awk -F T '{print }';'
#Date in seconds
lastsec='date -d "$lastd" +%s'
#Current date in seconds
now='date +%s'
days='echo $(( ($now - $lastsec) /60/60/24 ))'
if [[ $days -gt $LIMIT_DAYS ]]; then
sid='echo $ll | awk -F \| '{print }''
echo "terminating session: $sid, $days days old, lastd: $lastd, lastsec: $lastsec, now: $now"
x2goterminate-session $sid
fi
done