12345678910111213141516171819202122232425262728293031323334 |
- #! /bin/sh
- UPUSER=`pgrep xinit | xargs ps -o uname= -p`
- source /home/$UPUSER/.profile
- TMCONFIGPATH_NRM=/home/$UPUSER/.config/transmission-daemon
- TMCONFIGPATH_AUX=/home/$UPUSER/.config/transmission-daemon_no-manual
- try_run()
- {
- [[ $TORPART == $TORPART_NRM ]] && nohup transmission-daemon -g $TMCONFIGPATH_NRM && echo "Transmisson (normal) is starting..."
- [[ $TORPART == $TORPART_AUX ]] && nohup transmission-daemon -g $TMCONFIGPATH_AUX && echo "Transmisson (auxilliary) is starting..."
- transmission-remote -U
- transmission-remote -D
- return 0
- }
- cycle()
- {
- [[ -n `ifconfig tun0 | grep -q "00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00"` ]] && echo "[`date`] VPN isn't up" && return 0
- [[ -n `pgrep transmission` ]] && echo "[`date`] Transmission is already running, skipping..." && return 0
- try_run ""
- }
- while :
- do
- cycle ""
- sleep 180s
- done
- exit 0
|