Follow

Okay, how the hell do I make a systemd script wait until it's absolutely certain it can connect to a URL? >.>

· · Web · 1 · 0 · 0

@Jo I don't think it has builtin functionality to check a URL, so you'd have to write a program/script that does that, and set the Type= to something that waits, e.g. "Type=oneshot", which is considered ready once the main process exits.

Anything that needs that URL to be available then needs to be After= that one.

@faho Blargh.

I'm trying to get Lakka to mount a Samba share on boot, but apparently the only way to do that on this OS is using a systemd service: lakka.tv/doc/Serving-ROMs-from

(fstab isn't an option because the root filesystem is read-only)

Problem is, I think it's executing before it can even reach anything because it always fails on boot, but manually restarting it causes it to succeed. :blobtilt:

@Jo Huh, I'm pretty sure that "network-online.service" should be "network-online.target", not .service.

However note that this is a bit of a general pain point in systemd and in particular upstream always claimed it's impossible in the general case, so they defined that target and let the actual network thing fill it with meaning. You might also have to enable networkmanager-wait-online.service or similar, or you really do have a .service and it just doesn't wait enough?
freedesktop.org/wiki/Software/

@faho This would be so much easier if I could edit /etc/fstab, wouldn't it? :blobfrowningbig:

@Jo Would that help?

How would you explain that you need to be online for it in fstab?

@faho I dunno, but I've never had a problem doing it that way with my Mopidy Pi. :blobnervous:

@Jo Ah, there's some outdated (or just plain wrong) info here apparently.

The network dependencies should be added automatically, if you want to use a hostname instead of an IP you have to add nss-lookup as a dependency.

Also you could sidestep the ordering and make it an automount, so it's mounted once its needed (which should hopefully be late enough).

wiki.archlinux.org/index.php/s

Sign in to participate in the conversation
Disk Seven (Social)

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!