10. TRANSMISSION (The torrent Client)
You have some routine 'til here. So we start directly:
Code:
ipkg install transmission
ipkg install wget
Create working directories:
Code:
mkdir -p /tmp/harddisk/transmission/download
mkdir -p /tmp/harddisk/transmission/config/blocklists
chmod -R 770 /tmp/harddisk/transmission/
Config file:
Code:
vi /tmp/harddisk/transmission/config/settings.json
With this content:
Code:
{
"blocklist-enabled": true,
"dht-enabled": true,
"download-dir": "/tmp/harddisk/transmission/download",
"encryption": 2,
"lazy-bitfield-enabled": true,
"open-file-limit": 64,
"peer-limit-global": 250,
"peer-limit-per-torrent": 60,
"peer-port": 51413,
"peer-port-random-enabled": false,
"peer-port-random-high": 65535,
"peer-port-random-low": 1024,
"peer-socket-tos": 8,
"pex-enabled": true,
"port-forwarding-enabled": false,
"preallocation": 1,
"proxy": "",
"proxy-auth-enabled": false,
"proxy-auth-password": "",
"proxy-auth-username": "",
"proxy-enabled": false,
"proxy-port": 80,
"proxy-type": 0,
"rpc-authentication-required": false,
"rpc-enabled": true,
"rpc-password": "",
"rpc-port": 9091,
"rpc-username": "",
"rpc-whitelist": "127.0.0.1,192.168.1.*",
"rpc-whitelist-enabled": true,
"speed-limit-down": 500,
"speed-limit-down-enabled": false,
"speed-limit-up": 20,
"speed-limit-up-enabled": true
}
More config. These are changeing sometimes...
Create startup script:
Code:
vi /opt/etc/init.d/S90transmission-daemon
Content:
Code:
#!/bin/sh
#
# Startup script for transmission
case $1 in
start)
# update blocklist
echo "updating blocklist"
cd /tmp/harddisk/transmission/config/blocklists
if wget -q -N --tries=3 --timeout=10 http://www.bluetack.co.uk/config/level1.gz
then
if test -f level1.gz; then
rm level1
gunzip level1.gz
chmod go+r level1
fi
else
echo "Error $?. Blocklist NOT updated."
fi
# start transmission
echo "starting transmission"
nice /opt/bin/transmission-daemon -g /tmp/harddisk/transmission/config
;;
stop)
if [ -n "`pidof transmission-daemon`" ]; then
echo "stopping transmission"
kill -9 `pidof transmission-daemon`
fi
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 (start|stop|restart|force-reload)"
exit 1
esac
Make it executable and start it
Code:
chmod 755 /opt/etc/init.d/S90transmission-daemon
/opt/etc/init.d/S90transmission-daemon start
Check the transmission process with and browse (IE not supported) to transmission is working
It is a good idea to use ONE widely distributed torrent for testing transmission.
Download the torrent file, click OPEN in the webinterface and select your torrent file.
You will find the download in /tmp/harddisk/transmission/download.
Transmission uses port 51413.
More information on transmission: http://www.nslu2-linux.org/wiki/Optware/Transmission
11. Logrotate for Syslog
Install logrotate
Code:
ipkg install logrotate
Create folder for syslog (not /tmp any more)
Code:
mkdir -p /opt/var/log/
Edit crontab
Code:
vi /opt/etc/crontab
and add the following line
0 0 * * * admin /opt/sbin/logrotate -f /opt/etc/logrotate.conf &>/dev/null
Edit logrotate:
Code:
vi /opt/etc/logrotate.conf
Substitute the complete content with this:
compress
/opt/var/log/syslog.log {
size 1024k
weekly
rotate 9
postrotate
killall -HUP syslogd
endscript
}
include /opt/etc/logrotate.d
Syslog needs to be started:
Code:
vi /opt/etc/init.d/S05syslogd
Content:
Code:
#!/bin/sh
#
# Startup script for syslog
#
PATH=/opt/bin:/opt/sbin:/opt/local/bin:/sbin:/bin:/usr/bin:/usr/sbin
LOGFILE=syslog.log
KERNLOGFILE=kern.log
LOG_OLD=/tmp
LOG_NEW=/opt/var/log
prefix=""
sbindir=${prefix}/sbin
NAME=syslogd
DAEMON=${sbindir}/${NAME}
DESC="syslogd"
OPTIONS="-m 0 -O $LOG_NEW/$LOGFILE -S -l 7 -s 0"
case "$1" in
start0)
printf "Starting ${DESC}: "
# Copy old syslog and create symlink to new
if [ ! -L /tmp/syslog.log ]; then
cat $LOG_OLD/$LOGFILE >> $LOG_NEW/$LOGFILE
mv $LOG_OLD/$LOGFILE $LOG_NEW/$KERNLOGFILE
ln -s $LOG_NEW/$LOGFILE $LOG_OLD/$LOGFILE
fi
${DAEMON} ${OPTIONS}
printf "${NAME}.\n"
logger -t ${NAME} "started."
;;
stop)
if [ -n "`pidof syslogd`" ]; then
printf "Stopping ${DESC}: "
killall "${NAME}"
printf "${NAME}.\n"
fi
;;
start|restart|force-reload)
$0 stop
sleep 1
$0 start0
;;
*)
printf "Usage: $0 {start|stop|restart|force-reload}\n" >&2
exit
;;
esac
exit 0
And must be executable:
Code:
chmod +x /opt/etc/init.d/S05syslogd
To be sure, you know what will come, save and reboot:
Code:
flashfs save && flashfs commit && flashfs enable && reboot