Obsah

SystemD

Příkaz systemctl

systemctl --all --type help
Available unit types:
service
socket
busname
target
snapshot
device
mount
automount
swap
timer
path
slice
scope

Jednotka service

[Service]
EnvironmentFile=/etc/sysconfig/myservice.cfg
ExecStart=/usr/bin/myservice ${OPTIONS}
        

Jednotka timer

systemctl list-timers
NEXT                         LEFT       LAST                         PASSED       UNIT                         ACTIVATES
Sun 2017-12-03 11:00:59 CET  9min left  Sun 2017-12-03 10:01:46 CET  49min ago    anacron.timer                anacron.service
Sun 2017-12-03 11:09:00 CET  17min left Sun 2017-12-03 10:39:04 CET  12min ago    phpsessionclean.timer        phpsessionclean.service
Sun 2017-12-03 22:00:00 CET  11h left   Sun 2017-12-03 10:17:21 CET  34min ago    fstrim.timer                 fstrim.service
Mon 2017-12-04 01:02:19 CET  14h left   Sun 2017-12-03 10:17:17 CET  34min ago    apt-daily.timer              apt-daily.service
Mon 2017-12-04 06:04:13 CET  19h left   Sun 2017-12-03 06:59:46 CET  3h 51min ago apt-daily-upgrade.timer      apt-daily-upgrade.service
Mon 2017-12-04 06:47:32 CET  19h left   Sun 2017-12-03 06:47:32 CET  4h 4min ago  systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
systemctl cat fstrim.service
[Unit]
Description=Discard unused blocks

[Service]
Type=oneshot
ExecStart=/sbin/fstrim -a
systemctl cat fstrim.timer
[Unit]
Description=Discard unused blocks once a week
Documentation=man:fstrim

[Timer]
#OnCalendar=weekly
OnCalendar=Sun, 22:00
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target

Zdroje