Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


Timers

Reference(s)

Table of contents

TODO

$ sudo vi /etc/systemd/system/your.service

    > [Unit]
    > After=network.target
    > Description=Your description
    > Documentation=https://link.to.your.doc
    > Documentation=Other documentation msg
    >
    > [Service]
    > User=root
    > Group=root
    > ExecStart=/bin/bash -c "echo $(date) > /tmp/date.txt"
    >
    > [Install]
    > WantedBy=multi-user.target

$ sudo vi /etc/systemd/system/your.timer

    > [Unit]
    > Description=Your description
    > Documentation=https://link.to.your.doc  
    > Documentation=Other documentation msg
    > 
    > [Timer]
    > OnCalendar=daily
    > Persistent=true
    > #Unit=your.service # by default (link with the .service file)
    > 
    > [Install]
    > WantedBy=timers.target

$ systemctl daemon-reload
$ sudo systemctl enable your.timer
$ sudo systemctl enable your.service

If this cheat sheet has been useful to you, then please consider leaving a star here.