SIGTERM is not handled correctly, re-requests password
Posted: Wed Jun 24, 2020 7:51 pm
I automated openvpn startup via my own custom systemd service. It works well but killall openvpn fails to shutdown the process when invoked from the systemd service. Here is my service, it is as simple as a brick (/etc/systemd/system/my-ovpn-service.service):
When I run /usr/bin/killall openvpn from the command line it works as expected. I tried replacing it with killall openvpn, and with /usr/bin/pkill openvpn, tried specifying the signal explicitly as pkill -SIGTERM openvpn etc. All those invocations work as expected from command line (openvpn connection shuts down) but fail when executed from the service via ExecStop=. All it does is tries to re-authenticate into the remote server with the password.
I am lost at what I can do and need advice from the experts here
Code: Select all
[Unit]
Description=start/stop my OpenVPN connection on startup/shutdown
After=network-online.target
Requires=network-online.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/path/to/startup_script
ExecStop=/usr/bin/killall openvpn
[Install]
WantedBy=multi-user.target
I am lost at what I can do and need advice from the experts here