noob with asus520gu, optware, transmission 1.76, help needed

Ask for help and report issues not specific to either the Mac OS X or GTK+ versions of Transmission
dheerajjotwani
Posts: 16
Joined: Fri Jan 08, 2010 9:32 am

Re: noob with asus520gu, optware, transmission 1.76, help needed

Post by dheerajjotwani »

hey good news... it worked. i just disapbled the rpc whitelist since am only acessing it from the lan right now. out of the three scripts, the one that actually queued the torrent is

Code: Select all

#!/opt/bin/bash
#
# *************
# Configuration
REMOTE="/opt/bin/transmission-remote"
PATH=/opt/bin:$PATH
USERNAME=""
PASSWORD=""
MAXDOWN="1"
MAXACTIVE="2"
CONFIG="/mnt/Shared/Torrents/.config/transmission-daemon/settings.json"
#
# *************
# Set-up variables
CMD="$REMOTE --auth $USERNAME:$PASSWORD"
LOGCMD="/usr/bin/logger -t transmission-queue "
MAXRATIO=$(cat $CONFIG | grep \"ratio-limit\":)
MAXRATIO=${MAXRATIO#*\"ratio-limit\": }
MAXRATIO=${MAXRATIO%*, }
#
# *************
# deal with downloads
DOWNACTIVE="$($CMD -l | tail --lines=+2 | grep -v 100% | grep -v Sum | grep -v Stopped | wc -l)"
if [ $MAXDOWN -lt $DOWNACTIVE ]; then
	DOWNTOSTOP="$($CMD -l | tail --lines=+2 | grep -v 100% | grep -v Sum | grep -v Stopped | \
		tail -n $(expr $DOWNACTIVE - $MAXDOWN) | awk '{ print $1; }')"
	for ID in $DOWNTOSTOP; do
		NAME="$($CMD --torrent $ID --info | grep Name:)"
		$LOGCMD "<<< $ID: ${NAME#*Name: }"
		$CMD --torrent $ID --stop >> /dev/null 2>&1
	done
else
	[ $(expr $MAXDOWN - $DOWNACTIVE) -gt 0 ] && (
	DOWNINACTIVE="$($CMD -l | tail --lines=+2 | grep -v 100% | grep Stopped | wc -l)"
	[ $DOWNINACTIVE -gt 0 ] && (
		DOWNTOSTART="$($CMD -l | tail --lines=+2 | grep -v 100% | grep Stopped | \
			head -n $(expr $MAXDOWN - $DOWNACTIVE) | awk '{ print $1; }')"
		for ID in $DOWNTOSTART; do
			NAME="$($CMD --torrent $ID --info | grep Name:)"
			$LOGCMD ">>> $ID: ${NAME#*Name: }"
			$CMD --torrent $ID --start >> /dev/null 2>&1
		done
		)
	)
fi
# Then deal with total active
ACTIVE="$($CMD -l | tail --lines=+2 | grep -v Sum | grep -v Stopped | wc -l)"
if [ $MAXACTIVE -lt $ACTIVE ]; then
	TOSTOP="$($CMD -l | tail --lines=+2 | grep 100% | grep -v Stopped | \
		tail -n $(expr $ACTIVE - $MAXACTIVE) | awk '{ print $1; }')"
	for ID in $TOSTOP; do
		NAME="$($CMD --torrent $ID --info | grep Name:)"
		$LOGCMD "<<< $ID: ${NAME#*Name: }"
		$CMD --torrent $ID --stop >> /dev/null 2>&1
	done
else
	[ $(expr $MAXACTIVE - $ACTIVE) -gt 0 ] && (
	SEEDINACTIVE="$($CMD -l | tail --lines=+2 | grep 100% | grep Stopped | \
		awk -v ratio=$MAXRATIO '{ if (strtonum(substr($0,52,4)) < ratio) print $0 ;}' | wc -l)"
	[ $SEEDINACTIVE -gt 0 ] && (
		TOSTART="$($CMD -l | tail --lines=+2 | grep 100% | grep Stopped | \
			awk -v ratio=$MAXRATIO '{ if (strtonum(substr($0,52,4)) < ratio) print $0 ;}' | \
			head -n $(expr $MAXACTIVE - $ACTIVE) | awk '{ print $1; }')"
		for ID in $TOSTART; do
			NAME="$($CMD --torrent $ID --info | grep Name:)"
			$LOGCMD ">>> $ID: ${NAME#*Name: }" 
			$CMD --torrent $ID --start >> /dev/null 2>&1
		done
		)
	)
fi
now the glitch is to make it work more regularly. because i tested it by leaving it in the /opt/etc/cron.hourly/ folder and nothing happened.

how do we do that. which script are u using to queue torrents on your nas?

and a big thank you !
dheerajjotwani
Posts: 16
Joined: Fri Jan 08, 2010 9:32 am

Re: noob with asus520gu, optware, transmission 1.76, help needed

Post by dheerajjotwani »

hey,

now the script is fully executable and even the crond is running but even though the script resides in the /opt/etc/cron.hourly/ folder but it doesnt execute on its own every hour. cant we get to the crontab. i mean find it and edit it to include this script.

btw the script is saved as q.sh and to execute it i give command <bash /opt/etc/cron.hourly/q.sh> and is as follows:

Code: Select all

#!/opt/bin/bash
#
# *************
# Configuration
REMOTE="/opt/bin/transmission-remote"
PATH=/opt/bin:$PATH
USERNAME=""
PASSWORD=""
MAXDOWN="1"
MAXACTIVE="2"
CONFIG="/mnt/Shared/Torrents/.config/transmission-daemon/settings.json"
#
# *************
# Set-up variables
CMD="$REMOTE --auth $USERNAME:$PASSWORD"
LOGCMD="/usr/bin/logger -t transmission-queue "
MAXRATIO=$(cat $CONFIG | grep \"ratio-limit\":)
MAXRATIO=${MAXRATIO#*\"ratio-limit\": }
MAXRATIO=${MAXRATIO%*, }
#
# *************
# deal with downloads
DOWNACTIVE="$($CMD -l | tail --lines=+2 | grep -v 100% | grep -v Sum | grep -v Stopped | wc -l)"
if [ $MAXDOWN -lt $DOWNACTIVE ]; then
	DOWNTOSTOP="$($CMD -l | tail --lines=+2 | grep -v 100% | grep -v Sum | grep -v Stopped | \
		tail -n $(expr $DOWNACTIVE - $MAXDOWN) | awk '{ print $1; }')"
	for ID in $DOWNTOSTOP; do
		NAME="$($CMD --torrent $ID --info | grep Name:)"
		$LOGCMD "<<< $ID: ${NAME#*Name: }"
		$CMD --torrent $ID --stop >> /dev/null 2>&1
	done
else
	[ $(expr $MAXDOWN - $DOWNACTIVE) -gt 0 ] && (
	DOWNINACTIVE="$($CMD -l | tail --lines=+2 | grep -v 100% | grep Stopped | wc -l)"
	[ $DOWNINACTIVE -gt 0 ] && (
		DOWNTOSTART="$($CMD -l | tail --lines=+2 | grep -v 100% | grep Stopped | \
			head -n $(expr $MAXDOWN - $DOWNACTIVE) | awk '{ print $1; }')"
		for ID in $DOWNTOSTART; do
			NAME="$($CMD --torrent $ID --info | grep Name:)"
			$LOGCMD ">>> $ID: ${NAME#*Name: }"
			$CMD --torrent $ID --start >> /dev/null 2>&1
		done
		)
	)
fi
# Then deal with total active
ACTIVE="$($CMD -l | tail --lines=+2 | grep -v Sum | grep -v Stopped | wc -l)"
if [ $MAXACTIVE -lt $ACTIVE ]; then
	TOSTOP="$($CMD -l | tail --lines=+2 | grep 100% | grep -v Stopped | \
		tail -n $(expr $ACTIVE - $MAXACTIVE) | awk '{ print $1; }')"
	for ID in $TOSTOP; do
		NAME="$($CMD --torrent $ID --info | grep Name:)"
		$LOGCMD "<<< $ID: ${NAME#*Name: }"
		$CMD --torrent $ID --stop >> /dev/null 2>&1
	done
else
	[ $(expr $MAXACTIVE - $ACTIVE) -gt 0 ] && (
	SEEDINACTIVE="$($CMD -l | tail --lines=+2 | grep 100% | grep Stopped | \
		awk -v ratio=$MAXRATIO '{ if (strtonum(substr($0,52,4)) < ratio) print $0 ;}' | wc -l)"
	[ $SEEDINACTIVE -gt 0 ] && (
		TOSTART="$($CMD -l | tail --lines=+2 | grep 100% | grep Stopped | \
			awk -v ratio=$MAXRATIO '{ if (strtonum(substr($0,52,4)) < ratio) print $0 ;}' | \
			head -n $(expr $MAXACTIVE - $ACTIVE) | awk '{ print $1; }')"
		for ID in $TOSTART; do
			NAME="$($CMD --torrent $ID --info | grep Name:)"
			$LOGCMD ">>> $ID: ${NAME#*Name: }" 
			$CMD --torrent $ID --start >> /dev/null 2>&1
		done
		)
	)
fi
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: noob with asus520gu, optware, transmission 1.76, help needed

Post by rb07 »

You don't edit crontabs directly.

Use 'crontab -e' which puts you inside vi (an editor), hit 'i' (insert command) and write one line:

Code: Select all

@hourly /opt/etc/cron.hourly/q.sh
Hit ESC, then 'ZZ' (that's two uppercase z) and you'll get a message about 'new crontab installed'.

Cron works differently depending on the version you have installed, I was guessing you installed cron using optware so it should be a recent version, but I just checked and this version (ISC Cron V4.1) doesn't understand about cron.hourly. Your best source of accurate information is the optware Wiki (what version, where's the man page, features included/excluded).

BTW answering your other question, I don't queue my torrents anymore; since Transmission version 1.76 I've seen the little NAS handle a bunch of torrents with no problem, not even when I add 'encryption preferred' to the mix.
dheerajjotwani
Posts: 16
Joined: Fri Jan 08, 2010 9:32 am

Re: noob with asus520gu, optware, transmission 1.76, help needed

Post by dheerajjotwani »

^^^
now i am getting a permission denied for everything in putty even though i am logging in with the root account.

[root@Asus520gu root]$ ipkg install bash -force-reinstall
Reinstalling bash (3.2.49-1) on /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optwa ... mipsel.ipk
sh: wget: Permission denied
sh: rm: Permission denied
Nothing to be done
An error ocurred, return value: 22.
Collected errors:
ipkg_download: ERROR: Command failed with return value 127: `wget -q -P /opt/ipkg-0qgDYJ http://ipkg.nslu2-linux.org/feeds/optwa ... mipsel.ipk'
Failed to download bash. Perhaps you need to run 'ipkg update'?

this has been happening ever since i loaded bash
Post Reply