User Tools

Site Tools


systemd:auto-lock_the_computer_on_a_schedule_e.g._at_bedtime

This is an old revision of the document!


systemd - Auto-lock the computer on a schedule (e.g. at bedtime)

~/.config/systemd/user/lock-session-bedtime.service
[Unit]
Description=Lock session
 
[Service]
Type=simple
ExecStart=/usr/bin/loginctl lock-session
 
[Install]
WantedBy=default.target

NOTE: Create the folder if it does not exist.


~/.config/systemd/user/lock-session-bedtime.timer
[Unit]
Description=Lock session at night
 
[Timer]
OnCalendar=23:45
Unit=lock-session-bedtime.service
 
[Install]
WantedBy=default.target

NOTE: Modify the log out time as needed.

Take care not to make any other changes to the file.


Run

systemd --user daemon-reload
 
systemd --user enable --now \
        lock-session-bedtime.timer

systemd/auto-lock_the_computer_on_a_schedule_e.g._at_bedtime.1611239661.txt.gz · Last modified: 2021/01/21 14:34 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki