Open Bensge opened 3 years ago
You can restart the collectd service 5 minutes after the server had started booted. Assuming the network is up by then...
# @doc https://wiki.archlinux.org/index.php/Systemd/Timers
# Config
MYFILE=/etc/systemd/system/mjd-restart-collectd-after-lan-connected.timer
cat << 'THETEXTBLOCK' > ${MYFILE}
# A timer which will trigger ONCE, {x} minutes after the machine was booted.
[Unit]
Description=(timer)mjd-restart-collectd-after-lan-connected
[Timer]
OnBootSec=5min
[Install]
WantedBy=timers.target
THETEXTBLOCK
cat ${MYFILE}
ll ${MYFILE}
MYFILE=/etc/systemd/system/mjd-restart-collectd-after-lan-connected.service
cat << 'THETEXTBLOCK' > ${MYFILE}
# The .service file does not require an [Install] section as it is controlled by the related timer unit.
[Unit]
Description=mjd-restart-collectd-after-lan-connected
[Service]
Type=oneshot
ExecStart=/bin/sh -ec "systemctl restart collectd; systemctl status collectd"
THETEXTBLOCK
cat ${MYFILE}
ll ${MYFILE}
# ENABLE AT BOOT
MYUNIT=mjd-restart-collectd-after-lan-connected
MYSERVICE=${MYUNIT}.service
MYTIMER=${MYUNIT}.timer
systemctl enable ${MYTIMER};
systemctl status ${MYTIMER};
When my Raspberry PI 4 boots up, during the
collectd
startup, thefritzcolltectd
plugin chokes on the network because it doesn't appear to be connected yet. When I restartcollectd
manually, it works great. Is this problem known and are there any solutions to delay the startup until the network is ready?Cheers, Benno