Skip to content

Systemd

robnagler edited this page Feb 27, 2019 · 4 revisions

Systemd & Journalctl Hints

Timers

Timers consist of two units <name>.timer and <name>.service. The timer unit starts the service unit. When a timer is complete, it says Started.

List of timers:

# systemctl list-timers --all
NEXT                         LEFT          LAST                         PASSED               UNIT                         ACTIVATES
Thu 2018-05-03 18:45:06 UTC  4h 43min left Wed 2018-05-02 18:45:06 UTC  19h ago              systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Fri 2018-05-04 07:30:00 UTC  17h left      Thu 2018-05-03 07:30:06 UTC  6h ago               db_bkp.timer                 db_bkp.service
Fri 2018-05-04 07:50:00 UTC  17h left      Thu 2018-05-03 07:50:06 UTC  6h ago               logrotate.timer              logrotate.service
n/a                          n/a           n/a                          n/a                  societas_month.timer         societas_month.service
n/a                          n/a           n/a                          n/a                  societas_night.timer         societas_night.service
n/a                          n/a           n/a                          n/a                  societas_weekday.timer       societas_weekday.service
n/a                          n/a           Sun 2018-02-11 17:45:03 UTC  2 months 19 days ago systemd-readahead-done.timer systemd-readahead-done.service

The n/a means the timer is not started or active so you need to systemctl start societas_weekday.timer, for example.

Looking in the log

Check out how nightly jobs went:

journalctl -S -12h

You can say -3m for three minutes ago.

Or looking at a particularly unit:

journalctl -S -12h -u societas_night

You can specify a specific time, but it is awkward to specify last night.

Clone this wiki locally