You are not logged in.
I'm using netctl and I'm trying to make my own service. The idea is that my service is restarted if I do a
systemctl restart netctl@net0
or if I unplug and plug again the network cable with the service netctl-ifplugd@net0 enabled. First case is easy, but I don't find a solution for both cases, any suggestions?
Offline
I don't understand what you are trying to do.
I'm using netctl
https://wiki.archlinux.org/index.php/netctl
Do you want
netctl stop mynetwork
netctl start mynetwork
Offline
I wrote service like this:
[Unit]
Description=Service on interface %I
Wants=docker.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/lib/project/my_script.sh start %I
ExecStop=/usr/lib/project/my_script.sh stop %I
[Install]
WantedBy=multi-user.target
What I want is restart this service if I do a restart of the network, with 'netctl restart mynetwork' or automatically via the 'netctl-ifplugd@mynetwork' service. Ideally my service restart would be independent from netctl and only dependent of the network interface.
Offline
Try changing your service under [Unit] to:
[Unit]
Description=Service on interface %I
Wants=docker.service
PartOf=netctl-ifplugd@mynetwork.service
See 'man systemd.unit' for more info on the PartOf directive. I _think_ that's what you might be trying to do
Scott
Last edited by firecat53 (2014-10-03 15:26:32)
Offline
@firecat53, thanks for the info about the PartOf directive, I didn't know it and is really useful. But doesn't help in this case, service netctl-ifplugd watchs the interface for changes, but never restart itself. If I unplug and plug the network cable, the network is restarted, but not the service itself, and my service is not restarted.
Offline