You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
395 B
19 lines
395 B
2 months ago
|
#!/bin/bash
|
||
|
|
||
|
check_session_state() {
|
||
|
active_session=$(loginctl | grep "online" | awk '{print $1}')
|
||
|
|
||
|
for session in $active_session; do
|
||
|
current_state=$(loginctl show-session $session -p Active --value)
|
||
|
|
||
|
if [[ $current_state == "no" ]]; then
|
||
|
/usr/bin/loginctl lock-session $session
|
||
|
fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
while true; do
|
||
|
check_session_state
|
||
|
sleep 1
|
||
|
done
|