I created a small script to start openvpn but when I try to execute it i get the following error message and i don't know what i did wrong as i'm not that good with this language:
/etc/init.d/ovpn start
Options error: Unrecognized option or missing parameter(s) in [CMD-LINE]:1: cd (2.1.0)
Use --help for more information.
Here's my code:
#!/bin/sh -e
CONFIG_DIR=/etc/openvpn
start_vpn () {
# load the firewall
$CONFIG_DIR/firewall.sh
# load TUN/TAP kernel module
modprobe tun
# enable IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
openvpn --cd $dir --daemon --config server.conf
}
stop_vpn () {
killall -TERM openvpn
}
case "$1" in
start)
start_vpn
;;
stop)
stop_vpn
;;
restart)
stop_vpn
start_vpn
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
# vim:set ai sts=2 sw=2 tw=0: