참고자료
ExstallWiki
transmission auto start 관련
아래는 svn server의 autorun 관련 bash script. 적당히 수정하면 transmission autostart 될 듯
(while test ! -x "/opt/bin/svnserve"; do sleep 5; done; /opt/bin/svnserve -d --listen-port=81)&
transmission watch 동작 관련
#!/bin/bash
# Watch dir, may contain spaces:
watchdir="/share/HDA_DATA/Qdownload/watch/"
# move file to a subdirectory? if Commented out, it'll removed remove
# the torrent file.
# Note: Don't put a '/' before the path!
movesubdir="added/"
# Authentication "username:password":
#tr_auth="admin:admin"
# Transmission host "ip:port":
tr_host="192.168.1.5:9091"
# Verbose?
verbose=1
#############################################
time=$(date "+%Y-%m-%d (%H:%M:%S)")
if [ -n "$tr_auth" ]; then
tr_auth="--auth=$tr_auth"
fi
for file in "$watchdir"*.torrent
do
if [ -f "$file" ]; then
if [ -n "$verbose" ]; then echo "$time: $file added to queue.";
fi
transmission-remote "$tr_host" "$tr_auth" -a "$file"
# give the remote some time to process
sleep 5
if [ $movesubdir ]; then
if [ -d "$watchdir$movesubdir" ]; then
mv "$file" "$watchdir$movesubdir"
else
mkdir "$watchdir$movesubdir"
mv "$file" "$watchdir$movesubdir"
fi
else
rm "$file"
fi
else
if [ -n "$verbose" ]; then echo "$time: No torrent in $watchdir."; fi
fi
done
exit 0
#!/bin/sh # location: /share/custom/scripts/contab.sh # script name: crontab script # purpose: add entries to the crontab, which will survive a QNAP reboot # designed for Qnap TS-201 tmpfile=/tmp/crontab.tmp # read crontab and remove custom entries (usually not there since after a reboot # QNAP restores to default crontab: crontab -l | grep -vi "custom1.sh" | grep -vi "custom2.sh" > $tmpfile # add custom entries to crontab #echo "1 4 * * * /share/custom/scripts/custom1.sh" >> $tmpfile echo "0,15,30,45 * * * * /share/HDA_DATA/Qdownload/config/watchdog.sh" >> $tmpfile #load crontab from file crontab $tmpfile # remove temporary file rm $tmpfile # restart crontab /etc/init.d/crond.sh restart