I need to restart a faulty openvpn service which gets screwed by suspend/resume. My idea is to create a dedicated restart service as documented in many places (e.g. here), but I want the restart to happen only if the service was actually active at the moment of suspending, since I don't always use the VPN and I don't want it to be silently brought up by the resume procedure. I didn't find any clear indication about this use case, so any help is appreciated.
Asked
Active
Viewed 2,346 times
1 Answers
7
I found the answer to my own question: systemct try-restart. From man systemctl:
try-restart PATTERN...
Stop and then start one or more units specified on the command line if the units are running. This does nothing if units are not running.
Nicola Mori
- 261