Systemd - Task Scheduling
Schedule tasks on Linux using systemd timers and services.
Create Timer and Service
Create a Service
Create a file
/etc/systemd/system/myscript.service
[Unit]
Description="Put a description of the service"
[Service]
Type=simple
ExecStart=/path/to/your/script.sh
User=user_who_runs_the_program
Group=group_who_runs_the_programType
simple
exec
forking
oneshot
dbus
notify
idle
Create a Timer
Create a file
/etc/systemd/system/myscript.timer
Value for OnCalendar is on the systemd.time syntax: *-*-* *:*:*
Special keywords: hourly, daily, weekly, monthly, yearly
AccuracySec=1minAllow a 1-minute delay to group wakeups.RandomizedDelaySec=30minAdd random delay (up to 30 min).Persistent=trueRun missed jobs if the system was off.WakeSystem=trueWake up the system to run the job (requires suspend/hibernate support).
Enable & Start the Timer
More information
man systemd.timerman systemd.time
Last updated