Outils pour utilisateurs

Outils du site


tech:controle_parental_-_fermer_la_session_apres_une_certaine_heure

Contrôle parental - Fermer la session après une certaine heure

Avec une crontab

A faire : Notification de l'utilisateur

export EDITOR=vim
crontab -e
00 00 * * * /usr/bin/skill -TERM -u toto
#00 00 * * * /sbin/shutdown now

Avec SystemD

/etc/systemd/system/safe-hours-for-kids.service

[Unit]
Description=Safe hours for kids Service
Wants=network.target
After=network.target
 
[Service]
#ExecStart=bash -c '/usr/bin/date >> /tmp/plop.txt'
ExecStart=/usr/sbin/shutdown -h now
Type=oneshot
RemainAfterExit=no
 
[Install]
WantedBy=multi-user.target

/etc/systemd/system/safe-hours-for-kids.timer

[Unit]
Description=Run always between 23:00 and 23:59
 
[Timer]
#OnBootSec=15min
#OnUnitActiveSec=1w
# DayOfWeek Year-Month-Day Hour:Minute:Second
#OnCalendar=*-*-* 00,22..23:*:00
OnCalendar=*-*-* 23:00..23:59
 
[Install]
WantedBy=timers.target
systemd-analyze calendar "23:00..03:00"
systemd-analyze verify /etc/systemd/system/safe-hours-for-kids.service 
systemd-analyze verify /etc/systemd/system/safe-hours-for-kids.timer 
 
systemctl daemon-reload
systemctl stop --now safe-hours-for-kids.timer
systemctl enable --now safe-hours-for-kids.timer
 
systemctl status safe-hours-for-kids.timer

FIXME

tech/controle_parental_-_fermer_la_session_apres_une_certaine_heure.txt · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki