Skip to content
Snippets Groups Projects
Commit 92325d27 authored by Bruno BEAUFILS's avatar Bruno BEAUFILS
Browse files

vpn: ajout restart à vpnlille1

parent 804605e6
Branches master
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# COMMANDE # COMMANDE
# start démarre une connection au VPN personnels de Lille 1 # start démarre une connection au VPN personnels de Lille 1
# stop stoppe la connection au VPN personnels de Lille 1 # stop stoppe la connection au VPN personnels de Lille 1
# restart stop puis start
# conf génère un fichier LILLE1.ovpn # conf génère un fichier LILLE1.ovpn
# -h, --help, help affiche ce message d'aide # -h, --help, help affiche ce message d'aide
...@@ -131,18 +132,34 @@ EOF ...@@ -131,18 +132,34 @@ EOF
# doc is included as comments from 2nd line of the script to first empty line # doc is included as comments from 2nd line of the script to first empty line
doc () { sed -n '2,/^$/ { s/^ *#// ; s/^ //g ; t e ; d ; :e p }' <$0 ; } doc () { sed -n '2,/^$/ { s/^ *#// ; s/^ //g ; t e ; d ; :e p }' <$0 ; }
# Le travail effectif # démarrer le vpn
case "$1" in start_vpn ()
"start") {
verifie sudo verifie sudo
verifie openvpn verifie openvpn
sudo openvpn --daemon \ sudo openvpn --daemon \
--config ${vpnconf} --config ${vpnconf}
;; }
"stop")
# arrêter le vpn
stop_vpn ()
{
verifie pgrep verifie pgrep
pid=$(pgrep openvpn) pid=$(pgrep openvpn)
test -z "$pid" || sudo kill $pid test -z "$pid" || sudo kill $pid
}
# Le travail effectif
case "$1" in
"start")
start_vpn
;;
"stop")
stop_vpn
;;
"restart")
stop_vpn
start_vpn
;; ;;
"conf") "conf")
cp ${vpnconf} . cp ${vpnconf} .
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment