Skip to content
Snippets Groups Projects
Unverified Commit 7d8e527a authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Remove systemd-autologout script.

Ticket#2018110171000098
parent 5637d1e5
No related branches found
No related tags found
1 merge request!8Remove systemd-autologout script.
#!/bin/sh
# Maximum idle time in seconds
MAXIDLE=604800
# Get current UNIX timestamp
now=$(date +%s)
# Get IDs of all current sessions known to logind
sessions=$(loginctl list-sessions | awk 'NR<2 { next }; { if (!NF) exit; print $1 }')
for session in $sessions; do
# Get time sicne when session is idle; truncating six least significant digits to get UNIX timestamp
idlesince=$(loginctl show-session -p IdleSinceHint "$session" | sed -e 's/IdleSinceHint=//' -e 's/......$//')
# Skip session if not idle
test x"$idlesince" = x"0" && continue
# Calculate whether session is older than $MAXIDLE; use bc for 64-bit arithmetic
left=$(echo "$MAXIDLE < ($now - $idlesince)" | bc)
# If idle for too long, terminate
if test x"$left" = x"1"; then
logger -t systemd-autologout "Terminating session $session"
loginctl terminate-session "$session"
fi
done
......@@ -251,8 +251,6 @@
- { var: 'net.ipv4.tcp_mtu_probing', val: '1' }
- { var: 'net.ipv4.tcp_rfc1337', val: '1' }
- { var: 'net.ipv4.tcp_fin_timeout', val: '15' }
- name: Install systemd-autologout script
copy: src=files/systemd-autologout dest=/etc/cron.hourly/systemd-autologout mode=0755
- name: Install DNS key for dehydrated
copy: src=tmp/acme.key dest=/etc/dehydrated/acme.key mode=640
- name: Install dehydrated config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment