Created
April 2, 2018 22:52
-
-
Save ZuZuD/d344de0004d7fa40034149ed4ea93860 to your computer and use it in GitHub Desktop.
Kodi bash alias
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kodi_ip=192.168.0.100 | |
function cpkodi { | |
scp $@ root@$kodi_ip:/storage/tvshows | |
} | |
function lskodi { | |
ssh root@$kodi_ip ls -ltrh /storage/tvshows | |
} | |
function rmkodi { | |
ssh root@$kodi_ip "cd /storage/tvshows && rm $@" | |
echo $? | |
lskodi | |
} | |
function vpnkodi { | |
vpn=$(ssh root@$kodi_ip "ps |grep 'openvpn --config'|grep -v grep") | |
len_vpn=${#vpn} | |
echo -e 'Would you.. :\n 1) Connect to VPN Paris\n 2) List all VPN\n 3) Kill all VPN\n' | |
read choice | |
case $choice in | |
1) | |
if [ $len_vpn -gt 0 ]; then | |
location=$(echo $vpn |awk '{print $6}'| sed 's/.ovpn//') | |
echo 'VPN is connected to' $location | |
echo -e 'Current open VPN details:\n'$vpn | |
else | |
echo 'VPN not established...establishing connection...' | |
ssh root@$kodi_ip "cd ~/OpenVPN;openvpn --config Paris2.ovpn > /dev/null & echo done" | |
fi | |
;; | |
2) | |
if [ $len_vpn -gt 0 ]; then | |
echo -e 'Current open VPN details:' | |
ssh root@$kodi_ip "ps |grep 'openvpn --config'|grep -v grep" | |
else | |
echo 'No VPN to list' | |
fi | |
;; | |
3) | |
if [ $len_vpn -gt 0 ]; then | |
echo -e 'Following VPN will be killed:' | |
ssh root@$kodi_ip "ps |grep 'openvpn --config'|grep -v grep" | |
ssh root@$kodi_ip "killall openvpn" | |
else | |
echo 'No VPN to kill' | |
fi | |
;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment