Systemd/timers: Difference between revisions

imported>Onny
mNo edit summary
imported>Onny
Further usage info
Line 1: Line 1:
Timers are systemd unit files whose name ends in .timer that control .service files or events. Timers can be used as an alternative to cron. Timers have built-in support for calendar time events, monotonic time events, and can be run asynchronously.  
Timers are systemd unit files whose name ends in .timer that control .service files or events. Timers can be used as an alternative to cron. Timers have built-in support for calendar time events, monotonic time events, and can be run asynchronously.  


== Example usage ==
== Configuration ==


Following timer runs a systemd unit every 5 minutes which invokes a bash script
Following example timer runs a systemd unit every 5 minutes which invokes a bash script


<syntaxHighlight lang="nix">
<syntaxHighlight lang="nix">
Line 26: Line 26:
};
};
</syntaxHighlight>
</syntaxHighlight>
== Usage ==
List active timers and their current state
<syntaxhighlight lang="bash">
systemctl list-timers
</syntaxhighlight>
Manually run service once for testing purpose
<syntaxhighlight lang="bash">
systemctl start hello-world
</syntaxhighlight>