E
E
evgeniy00902020-05-21 12:07:53
linux
evgeniy0090, 2020-05-21 12:07:53

How to start service in linux after raising network?

There is a service in /etc/init.d/myservice, it starts before the network is up, how to make the service start after the network is up?

Clarification, 2 providers are configured, one wired second modem. The wired one rises quickly, it takes 40 seconds to start the modem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfg21, 2020-05-21
@pfg21

put the start of the service in /etc/network/if-up.d
or in the cron
or in the service script, before starting the cycle waiting for the network to turn on or for the ping to pass to some server.
with systemd a couple more options are possible.
etc.
choose.

A
Andrey Barbolin, 2020-05-21
@dronmaxman

(/etc/systemd/system/test.service)
[Unit]
Description=test service
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/root/test.script

[Install]
WantedBy=multi-user.target

systemctl enable test

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question