Add Gaja to the list of computers

This commit is contained in:
2026-06-08 22:46:46 +02:00
parent c337a0d5f1
commit b15f87e3d5
2 changed files with 34 additions and 2 deletions

19
off.sh
View File

@ -20,6 +20,24 @@ gabi_check()
doas loginctl terminate-user gabi
}
gaja_check()
{
ping -c 1 -W 1 192.168.1.122 2>&1 >/dev/null || { echo "Gaja's PC is unreachable."; return; }
# Check if Gaja has any sessions
sshpass -p Nagaja ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no -F /dev/null gaja@192.168.1.122 \
"loginctl list-sessions --no-pager 2>/dev/null | grep -q gaja" 2>&1
if [ $? -ne 0 ]; then
echo "Gaja is not online."
return
fi
# Terminate all of Gaja's sessions (SSH drops = success)
sshpass -p Nagaja ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no -F /dev/null gaja@192.168.1.122 \
"loginctl terminate-user gaja" 2>/dev/null
echo "Gaja's PC: logged out."
}
S=$(date -d "$TIME_START" +%s)
T=$(date -d "$TIME_STOP" +%s)
C=$(date +%s)
@ -32,6 +50,7 @@ then
else
echo "ACTIVE: Executing for the next $((T - C)) seconds."
gabi_check
gaja_check
tv_check
fi