Skip to content

Commit

Permalink
Add wait-network-online.service
Browse files Browse the repository at this point in the history
Add a service which waits (max 15 seconds) for the network to be
available. We define 'available' as the ability to ping our default
router by its name, which implies dns is working.

Service units, which really need network to start, should add

    After=network-online.target
    Wants=network-online.target
  • Loading branch information
donald committed Jul 4, 2023
1 parent 2987558 commit daf7f8a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ install_symlink /etc/local/access.conf "$DESTDIR$sysconfdir/s
install_data misc_etc_files/cups/client.conf "$DESTDIR$sysconfdir/cups/client.conf"
install_data misc_systemd_units/ip6.service "$DESTDIR$systemdunitdir/ip6.service"
install_data mxrouter/mxrouter.service "$DESTDIR$systemdunitdir/mxrouter.service"
install_data misc_systemd_units/wait-network-online.service \
"$DESTDIR$systemdunitdir/wait-network-online.service"

postinstall
exit
14 changes: 14 additions & 0 deletions misc_systemd_units/wait-network-online.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
DefaultDependencies=no
After=sysinit.target network.target
Before=network-online.target

[Service]
Type=oneshot
RemainAfterExit=true
TimeoutStartSec=15
StandardOutput=null
ExecStart=bash -c 'while ! ping -c 1 -w 1 rick.molgen.mpg.de; do sleep 1 ; done'

[Install]
WantedBy=network-online.target

0 comments on commit daf7f8a

Please sign in to comment.