[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

Re: [Openvpn-users] autostart in FreeBSD


  • Subject: Re: [Openvpn-users] autostart in FreeBSD
  • From: Tadaaki Nagao <nagao@xxxxxxxxx>
  • Date: Sun, 26 Dec 2004 00:34:31 +0900 (JST)

Hi,

In "[Openvpn-users] autostart in FreeBSD",
    deep xploit <deepxploit@xxxxxxxxx> wrote:
> does anyone know how to autostart openvpn on system boot for a FreeBSD box !
> i've tried using openvpn-startup.sh inside /usr/local/etc/rc.d/ but
> didn't work and generated an error about tap devices.however,after
> system reboot when i try to execute the script manually it works
> correctly.
> 
> any ideas ?

I'm using the attached script /usr/local/etc/rc.d/openvpn.sh with
/usr/ports/sysutils/rc_subr installed on some FreeBSD boxes here.
Hope it helps.

Thanks,
Tadaaki Nagao <nagao@xxxxxxxxx>
System Design and Development Division, Internet Initiative Japan Inc.
#!/bin/sh

# PROVIDE: openvpn
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: FreeBSD shutdown

. /usr/local/etc/rc.subr

name="openvpn"
rcvar=`set_rcvar`
command="/usr/local/sbin/${name}"
pidfile="/var/run/openvpn.pid"
required_dirs="/usr/local/etc/openvpn"
required_files="/usr/local/etc/openvpn/openvpn.conf"

openvpn_enable=${openvpn_enable:-"NO"}
openvpn_flags=${openvpn_flags:-"--config ${required_files}"}

load_rc_config $name
run_rc_command "$1"