Create a .timer systemd unit file to control the execution of your .service unit file.
By convention, the timer unit starts another unit with the same name,
i.e. foo.timer starts foo.service.
$ cat <<EOF | sudo tee /etc/systemd/system/foo.timer
[Unit]
Description=Timer for the foo service
[Timer]
OnBootSec=1min
[Install]
WantedBy=timers.target
EOF
It is important that the service is disabled (so it doesn't start at boot),
and the timer enabled.
sudo systemctl disable foo.service
sudo systemctl enable foo.timer
sudo systemctl daemon-reload
sudo systemctl list-timers
Ref:
https://sleeplessbeastie.eu/2022/04/04/how-to-delay-the-start-of-the-systemd-service/
Friday, June 24, 2022
How to delay the start of the systemd service
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment