Linux • An init system • A service manager • Manages services as “unit” 2. A software suite for Linux • Including 1. • systemd(service manager), journald, systemd-tmpfiles, …
three sections 1. [Unit] section • Generic information about the unit 2. [Install] section • Installation information for the unit 3. Type-specific section
after the main service process has been forked off • forking: expected the process will call fork() • oneshot: expected the unit up after the main process exits
extension is .timer • foo.timer calls foo.service by default • WantedBy=timers.target • systemctl list-timers to list up current active timers • Two type of timer
OnActivateSec: after activated the timer • OnBootSec: after booted up the machine • OnStartupSec: after systemd was started • OnUnitActiveSec: after last activated • OnUnitInactiveSec: after last deactivated
DayOfWeek Year-Month-Day Hour:Minute:Second Timezone • Some shorthand is predefined • … , monthly, weekly, yearly, quarterly… • Weekday is defined as English name • Wed or Wednesday • * is for wildcard, .. is for range, / is for repetition, ~ is for last
independently of timers • So easy to debug • Jobs can be set up to depend on other units • Jobs can be set up with specific environment • The logs are reported into journal
• systemd-journald.service • Save logs into /var/run/log/journal • Auto-collect logs from stdout/stderr of systemd services • Syslog messages from local processes • Message posted to journald API