Tuesday, October 13, 2009

Problem with updateblocklist.sh script

Problem with the updateblocklist.sh script

As indicatecd in my earlier update on 23rd September 2009, an anonymous poster had help in solving the schedule of the editcron.sh script.

By changing it to something like "/bin/echo "0 0 * * 2 /ffp/var...." so it only runs once every Tuesday instead many, many time on Tuesday.

Or,
"/bin/echo "15 3 * * 2 /ffp/var...." will mean the script to run on every Tuesday at 0315hrs.

Or, "/bin/echo "0 1 * * 3 /ffp/var...." will mean the script to run on every Wednesday at 0100hrs.

Hope the above two examples will help all to understand the settings for the schedule.

Now to the updateblocklist.sh script. The script execute with no errors when I run it in PuTTY.

However, when I let the script run as in the schedule, the log shows the folllowing error.

Starting transmission-daemon /ffp/start/transmission.sh: line 42: su: not found

On checking the transmission.sh script, line 42 is

run_rc_command "$1"

In the beginning of the script, it is able to stop transmission by the following command.

/ffp/start/transmission.sh stop

However, at the end of the updateblocklist.sh script, the error appears. Now I have to execute this script manually.

I hope someone will be able to help to solve this problem.

Original script from Mike site http://www.horto.ca/?p=10

#!/bin/sh
##############################################################################
# ---[ updateblocklist.sh ] ---
# script to look update blocklist, unzip and restart transmission
# w 17/11/08 cheongseeker
# w help from horto
# ref charles kerr, transmission developer
#ref http://forum.transmissionbt.com/viewtopic.php?p=26575#p26575
##############################################################################
# define variable WGET with an absolute path
# define variable GUNZIP with an absoulet path
# define variable BLOCKLIST with an absolute path
WGET=/ffp/bin/wget
GUNZIP=/ffp/bin/gunzip
BLOCKLIST=/mnt/HD_a2/.transmission-daemon/blocklists/level1
BLOCKLISTBIN=/mnt/HD_a2/.transmission-daemon/blocklists/level1.bin
#stop transmission
/ffp/start/transmission.sh stop
/ffp/start/transmission.sh stop

# check file level1.gz if exist then delete
if [ -f level1.gz ]; then
rm level1.gz
fi

# check variable BLOCKLIST if exist then delete
if [ -f $BLOCKLIST ]; then
rm $BLOCKLIST
fi

# check variable BLOCKLISTBIN if exist then delete
if [ -f $BLOCKLISTBIN ]; then
rm $BLOCKLISTBIN
fi

# download the blocklist level1.gz from htp://download.m0k.org/transmission/files/level1.gz
# and save to /mnt/HD_a2/.transmission-daemon/blocklists
$WGET http://download.m0k.org/transmission/files/level1.gz -P /mnt/HD_a2/.transmission-daemon/blocklists

#cd /mnt/HD_a2/.transmission-daemon/blocklists
cd /mnt/HD_a2/.transmission-daemon/blocklists

#unzip level1.gz with variable GUNZIP
$GUNZIP level1.gz

#restart transmission in order for transmission to recognize the new blocklists
/ffp/start/transmission.sh stop
/ffp/start/transmission.sh start
/ffp/start/transmission.sh start

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]