openvpn.init 394 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. #FWINIT 60
  3. . /etc/rc.conf
  4. case $1 in
  5. autostop) ;;
  6. autostart)
  7. test x"${openvpn:-NO}" = x"NO" && exit 0
  8. exec sh $0 start
  9. ;;
  10. start)
  11. for c in $(ls /etc/openvpn/*.conf 2>&-); do
  12. openvpn --cd /etc/openvpn --config "$c" --daemon
  13. done
  14. ;;
  15. stop)
  16. killall openvpn
  17. ;;
  18. restart)
  19. sh $0 stop
  20. sleep 3
  21. sh $0 start
  22. ;;
  23. *)
  24. echo "Usage: $0 {start | stop | restart}"
  25. exit 1
  26. ;;
  27. esac
  28. exit $?