mirror of
https://github.com/edu4rdshl/linuxscripts.git
synced 2026-07-17 23:24:52 +00:00
Move randomvpn to system-bin
This commit is contained in:
parent
f35da46f10
commit
ac71b098e4
1 changed files with 0 additions and 24 deletions
24
randomvpn
24
randomvpn
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
# Script to select a random VPN client from /etc/openvpn/client/ (the default openvpn directory)
|
||||
|
||||
workdir="/etc/openvpn/client/"
|
||||
|
||||
if [ $UID -ne 0 ]; then
|
||||
echo "You need root privileges."
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$1" == "stop" ]; then
|
||||
systemctl stop openvpn-client@*
|
||||
exit
|
||||
fi
|
||||
|
||||
if command -v openvpn > /dev/null && command -v systemctl > /dev/null; then
|
||||
cd "$workdir"
|
||||
vpn=$(shuf -ezn 1 * | xargs -0 -n1 | cut -f1 -d '.')
|
||||
$(sudo systemctl start openvpn-client@$vpn)
|
||||
exit
|
||||
else
|
||||
echo "OpenVPN or systemd not installed, exiting."
|
||||
exit
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue