Start
systemctl start fvapp-qbittorrentr6
Stop
systemctl stop fvapp-qbittorrentr6
Start
systemctl start fvapp-qbittorrentr6
Stop
systemctl stop fvapp-qbittorrentr6
#!/bin/bash
ROUTER_CHECK_HOSTNAME="mooo.com"
NAS_IP=$(curl ifconfig.me)
ROUTER_IP=$(getent hosts ${ROUTER_CHECK_HOSTNAME} | awk '{ print $1 }')
QBITTORRENT_STATUS=$(systemctl status fvapp-qbittorrentr6 | grep 'Active:')
if [[ "$QBITTORRENT_STATUS" =~ .*"active (running)".* && $NAS_IP == $ROUTER_IP ]]; then
        # Kill torrents
        systemctl stop fvapp-qbittorrentr6
elif [[ "$QBITTORRENT_STATUS" =~ .*"inactive (dead)".* && $NAS_IP != $ROUTER_IP ]]; then
        #Start torrents
        systemctl start fvapp-qbittorrentr6
#else
#  echo "everything is ok!"
fi
if [[ "$QBITTORRENT_STATUS" =~ .*"active (running)".* ]]; then
        echo "BT Running - NAS IP - ${NAS_IP}"
else
        echo "BT is down - NAS IP - ${NAS_IP}"
fi