mirror of
https://github.com/edu4rdshl/linuxscripts.git
synced 2026-07-17 23:24:52 +00:00
Avoid lazy arguments, multiple OpenVPN clients running at time and optimize syntax.
This commit is contained in:
parent
bd5c92a649
commit
e4bd13efcf
1 changed files with 9 additions and 4 deletions
|
|
@ -12,12 +12,17 @@ if [ $UID -ne 0 ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
if $isopenvpn && $issystemd && [ "$1" == "stop" ]; then
|
||||
systemctl stop openvpn-client@*
|
||||
if [ ! -z $isopenvpn ] || [ ! -z $issystemd ]; then
|
||||
echo "OpenVPN or systemd not installed, exiting."
|
||||
exit
|
||||
fi
|
||||
|
||||
if $isopenvpn && $issystemd; then
|
||||
if [ "$1" == "stop" ]; then
|
||||
systemctl stop openvpn-client@*
|
||||
exit
|
||||
|
||||
elif [ "$1" == "start" ]; then
|
||||
systemctl stop openvpn-client@*
|
||||
if [ -d "$workdir" ]; then
|
||||
cd "$workdir"
|
||||
vpn=$(shuf -ezn 1 * | xargs -0 -n1)
|
||||
|
|
@ -34,6 +39,6 @@ if $isopenvpn && $issystemd; then
|
|||
exit
|
||||
fi
|
||||
else
|
||||
echo "OpenVPN or systemd not installed, exiting."
|
||||
echo -e "Usage:\n $0 start - start a random OpenVPN client. \n $0 stop - stop the initialized OpenVPN client."
|
||||
exit
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue