39 lines
667 B
Bash
39 lines
667 B
Bash
#!/bin/bash
|
|
|
|
torrent-check(){
|
|
TORRENT_CHECK=$(ss -tlnp | grep -i rtorrent)
|
|
if [ ! -z "$TORRENT_CHECK" ]; then
|
|
echo "rTorrent is running!"
|
|
else
|
|
echo "rTorrent is not in Running!"
|
|
rm -f /root/rtorrent.lock
|
|
rm -f /root/Downloads/rtorrent.lock
|
|
/usr/bin/rtorrent &
|
|
fi
|
|
|
|
|
|
|
|
}
|
|
|
|
vpncheck(){
|
|
VPN_CHECK=$(ip a | grep -i wg0)
|
|
if [ ! -z "$VPN_CHECK" ]; then
|
|
echo "VPN is running!"
|
|
sleep 20
|
|
torrent-check
|
|
vpncheck
|
|
else
|
|
echo "VPN is not in Running!"
|
|
killall "/usr/bin/rtorrent"
|
|
killall openvpn
|
|
wg-quick up wg0
|
|
sleep 20
|
|
vpncheck
|
|
fi
|
|
}
|
|
apt update;apt install resolvconf -y
|
|
cp -f /opt/.rtorrent.rc /root/
|
|
npm start &
|
|
vpncheck
|
|
tail -f /dev/null
|