You are not logged in.
Hi all!
I switched to full systemd as cron replacement since systemd 212 and use reflector a a daily service. (see https://wiki.archlinux.org/index.php/Sy … #Reflector)
Using the exact service described in the wiki, (Type=oneshot, etc.), I had the following issues:
timer-daily.timer failed because reflector.service failed (and thus the daily timer stops running from this moment on!);
timer-daily.timer did not finish on day 1 because reflector hang and was not launched many days in a row before I noticed it was stuck.
To try and solve these issues, I'd like to be able:
Set a custom Timeout before to kill the service if needs to be (too slow or hung);
Make sure the service restarts if it failed.
Now, I have the following .service:
[Unit]
Description=Update mirorlist
After=network.target
[Service]
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
Type=simple
TimeoutSec=600
Restart=on-failure
ExecStart=-/usr/bin/reflector -i (fr|nl|be). -f 5 --save /etc/pacman.d/mirrorlist
However, when running it without any network connection, I get
# systemctl status reflector.service
● reflector.service - Update mirorlist
Loaded: loaded (/etc/systemd/system/timer-daily.target.wants/reflector.service)
Active: inactive (dead) since Sat 2014-05-17 16:25:11 CEST; 15s ago
Process: 17920 ExecStart=/usr/bin/reflector -i (fr|nl|be). -f 5 --save /etc/pacman.d/mirrorlist (code=exited, status=1/FAILURE)
Main PID: 17920 (code=exited, status=1/FAILURE)
May 17 16:25:10 schizophrenia systemd[1]: Started Update mirorlist.
May 17 16:25:11 schizophrenia reflector[17920]: error: failed to retrieve mirror data: (<urlopen error [Errno -2] Name or serv...nown>)
Hint: Some lines were ellipsized, use -l to show in full.
I'm not sure if I'm doing it right (obviously not, though) and think that this kind of issue could be discussed here and put in the wiki (as a working example of tricky program that will sometimes fail, without making all timers fail).
Cheers
Last edited by Moviuro (2014-06-28 10:33:33)
bspwm, BTRFS over LUKS
Archlinux a lot, FreeBSD more and more...
Murphy's rule: The day you need a backup, you tell yourself you should have created some.
Offline
# cat /etc/systemd/system/reachable-retry@.service
[Unit]
Description=Test if %i is reachable
After=systemd-networkd-wait-online.service
# Customize to your own needs, with network.target or whatever works less worse with you
[Service]
Type=forking
ExecStart=/usr/bin/ping -c1 %i
Restart=on-failure
[Install]
WantedBy=multi-user.target
Adding dependencies to the service:
# cat /etc/systemd/system/reflector.service
[Unit]
Description=Update mirorlist
# Fire up the tester
Requires=reachable-retry@www.archlinux.org.service
# Wait for it to return SUCCESS
After=reachable-retry@www.archlinux.org.service
[Service]
# Copied from wiki
Nice=19
IOSchedulingClass=2
IOSchedulingPriority=7
Type=oneshot
Restart=on-failure
# Customize to your own needs
ExecStart=-/usr/bin/reflector -i (fr|nl|be). -f 5 --save /etc/pacman.d/mirrorlist
bspwm, BTRFS over LUKS
Archlinux a lot, FreeBSD more and more...
Murphy's rule: The day you need a backup, you tell yourself you should have created some.
Offline