Hi,
I have a debian 7.6 server (still using systemV init) running openvpn server, it works well as system service but I would like to make it restart automatically if, for any reason, the service crashes.
the service regularly starts/stops using
# service openvpn start|stop
I never used such a feature before, so I did the usual searches, and found this
https://www.digitalocean.com/community/tutorials/how-to-configure-a-linux-service-to-start-automatically-after-a-crash-or-reboot-part-1-practical-examples
but after trying a lot of different /etc/inittab lines, I gave up.
KIlling the service-initiated process with kill -9, the service never comes up again.
I have to start it manually from the shell.
first, I tested a command line command that works, it starts the vpn with the right config:
#/usr/sbin/openvpn --cd /etc/openvpn --config /etc/openvpn/server.tun.conf
ok, then added this line, to /etc/inittab, in several flavours:
eg, using a /etc/inittab line like
----------------------
OV:2345:respawn:/usr/sbin/openvpn --cd /etc/openvpn --config /etc/openvpn/server.tun.conf
----------------------
or, creating a script and trying to run that through the shell:
----------------------
OV:2345:respawn:/bin/bash /etc/openvpn/respawn.sh
----------------------
being /etc/openvpn/respawn.sh:
----------------------
#!/bin/bash
/usr/sbin/openvpn --cd /etc/openvpn --config /etc/openvpn/server.tun.conf
----------------------
it never works.
in the syslog I always find, instead:
----------------------
Jul 7 10:40:41 altvpn init: Id "OV" respawning too fast: disabled for 5 minutes
----------------------
Can someone shed some light to make this work?
Thanks,
Marco