Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got two different OpenVPN servers running on a box and I want to restart one of them (and leave the other untouched). I know I can restart all OpenVPN service using service openvpn restart, but then that restarts all OpenVPN services.

Is there a way to restart a specific OpenVPN server using the service command?

share|improve this question
up vote 3 down vote accepted

As the /etc/init.d/openvpn script (which is what gets executed by /usr/sbin/service) does not offer any options to do it (at least with ubuntu-10.04), the answer is no.

But since it is all scripts, you can just edit /etc/init.d/openvpn and add something like

  log_action_begin_msg "Restarting $DESC $2"
  log_daemon_msg "  Stopping VPN '$NAME'"
  sleep 1
  log_daemon_msg "  Restarting VPN '$NAME'"
  if test -z "$PIDFILE" ; then
    log_warning_msg "  VPN $2 is not running."

after the

case "$1" in

dirctive. Later, you can simply call service openvpn named-restart <vpn-name>.

share|improve this answer

the cmd "service openvpn restart" don't do distinction, it restart the services. I think an solution might be to reload the service. It will not cut the service doing, but reload the configuration file. So It might do the trick.

Else I don't think you can restart one of you vpn without restart the other with the service cmd.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.