-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclient-disconnect.sh
executable file
·30 lines (23 loc) · 1.14 KB
/
client-disconnect.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#======================================================================================================================
# vim: softtabstop=4 shiftwidth=4 expandtab fenc=utf-8 spell spelllang=en cc=120
#======================================================================================================================
#
# FILE: client-disconnect.sh
#
# DESCRIPTION: Shell executable used during client disconnect; parameters passed to openvpn.php
#
# BUGS: https://github.com/helin24/openvpn-php-access/issues
#
# LICENSE: GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
# ORGANIZATION: Helin Shiah
# CREATED: Mon May 2 09:38:36 PDT 2016
#======================================================================================================================
## Parameters
PHPCLI=$(which php)
SUDO=$(which sudo)
## Sanity check
if [[ -z "${PHPCLI}" || "${PHPCLI}" = "" ]]; then echo "ERROR: PHP NOT INSTALLED" && exit 1 ; fi
if [[ -z "${SUDO}" || "${SUDO}" = "" ]]; then echo "ERROR: SUDO NOT FOUND" && exit 1 ; fi
## Black magic
${SUDO} --preserve-env ${PHPCLI} $(pwd)/openvpn-php-access/openvpn.php disconnect