[systemd-devel] Q: Start a unit n minutes after a successful boot

Reindl Harald h.reindl at thelounge.net
Tue Sep 8 09:25:42 UTC 2020



Am 08.09.20 um 09:21 schrieb Ulrich Windl:
> Configuring a new system with non-redundant system disk I'm wondering: How could I start an automatic backup job that is triggered n minutes after the system started

* create a own target
* order it after multi-user.target
* put a service jn there which sleeps
* after the sleep or by a service ordered after that one
  do whatever you want to do

-------------------------

that below is something similar to not break existing connections by
reboot the gateway by disable nf_conntrack_tcp_loose at boot but do it
90 seconds later, in that cae no own target needed

[root at firewall:~]$  cat /etc/systemd/system/network-up-post.service
[Unit]
Description=Network Invalid-Detection
After=network-up.service
Requires=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=90
ExecStart=/usr/bin/sleep 30
ExecStart=/usr/sbin/sysctl -q -e -w net.netfilter.nf_conntrack_tcp_loose=0

[Install]
WantedBy=multi-user.target


More information about the systemd-devel mailing list