since the low performance of MBWE I wonder if is possible automatically stop transmission when someone access to the MBWE and start again when the MBWE is idling
Have you tried starting transmission with "nice"?
What kind of performance issues do you have?
Did you run "top" whilst having these issues?
I might incorporate an automatic start / stop depending on the need of smbd….
I just finished writing the script
you can test it if you want…
You may need to edit the start/stop script….
I start transmission with: /opt/etc/init.d/S90transmission
and stop transmission with: /opt/etc/init.d/K90transmission
cd /usr/bin
rm trans_watchdog
wget http://wd.mirmana.com/trans_watchdog
chmod +x trans_watchdog
Hi Frater, thanks for your new scriptversion. I use transmission on my wl500g asus router, however this new version crashes regularly at night. Perhaps the systemload is too high, or something else is going on. I tried to run your script only every hour, in order to see if this could solve the problem, also now after a couple of hours it crashes. Could you give a hint how to create a log for overnight activity of transmission? The previous version included a plot.
Another question, I cannot find K90transmission script for stopping transmission. Could you post the script?
Thanks,
Ecori
K90transmission is a symbolic link to S90transmission
ln -s /opt/etc/init.d/S90transmission /opt/etc/init.d/K90transmission
Do download the script another time, because I made some updates to control the behaviour.
although I looked at transmission_watchdog to see how that one does the job, my script is totally written from the ground up. Was this plot useful? If so, I might incorporate it, but not right now….
The latest watchdog has code to keep transmission alive.
I haven't tested it on another platform than the mybook, so I recommend running the script from command-line to see if it does strange things…..
I thought the plot was useful, so I could check the activity in the night. A table is enough though. I try the script from the command-line, and now problems occur. My problem is a crash of transmission after a couple of hours, possibly overloading the system, I don't know.
Thans for your help.
please tell me what kind of troubles.
Does the script crash somewhere?
Does transmission crash when my script is not running…
What's the output of trans_watchdog when you run it from command-line?
Hi frater,
Been away for awhile, now testing the newest scripts of yours, I have to adjust some paths to fit my setup. The newest one gives errormessages (in contrast to the former one):
Script : transmission_watchdog PID: 212
Script Running: 0
Transmission running: 2
top: User name does not exist.
SMB:
Transmission was already running
I noticed that finished downloads with ratio 2.5 was not stopped automatically (worked before), and in my system log it was continuously repeated "Script already running" (how can I stop a script from the command line?). I think this problem was due to these lines I copied from your site:
if [ -f "${WORK}/.watchdog" ]; then
- rm -f "${WORK}/.watchdog"
logger -s "Script already running"
exit 0
fi
touch "${WORK}/.watchdog"
I guess I have now a problem in:
SMBD=‘top -b -n5 -d0.5 -uwww-data | grep smbd | awk ’{print $9}' | sort | awk 'NR == 3'`
But I don't understand what it means or how to correct it. Is this possibly a path problem?
Hi,
I am a bit further now I think, added username to the top command:
if [ "${SUPERSOCIAL}" -ne "0" ]; then
SAMBABUSY=0
SMBD=‘top -b -n5 -d0.5 -u ecori | grep smbd | awk ’{print $9}' | sort | awk '$
debug "SMB: ${SMBD}"
Is this correct? I don't get the errormessage anymore.
When run manually, the script (named transmission_watchdog in my case) returns:
Script : transmission_watchdog PID: 695
Script Running: 0
Transmission running: 5
SMB: 0.0
Samba too busy: 0
Transmission was already running
—
SMB:0.0 is always shown, indespite of samba activity or not.
systemlog reports every 10 min (according to the cron job settings):
transmission_watchdog already running… it will stop
In this part of the script I think an error occurs:
IS_RUNNING=`ps -efu${USER} |grep "${SCRIPT}" | grep -v grep | grep sh | grep -vc ${PID}`
debug "Script : ${SCRIPT} PID: ${PID}"
debug "Script Running: ${IS_RUNNING}"
if [ "${IS_RUNNING}" -gt "0" ]; then
logger -s "${SCRIPT} already running… it will stop"
exit 0
fi
edit: FOund problem: space missing in front of grep "${SCRIPT}"
I made some more changes in the code.
My platform doesn't have problems with a missing space there and it's new for me any platform has…
Anyhow, changed it.
I'm using a different method to detect if the watchdog is already running.
Please give me the output of this new one…
cd /usr/bin
rm trans_watchdog
wget http://wd.mirmana.com/trans_watchdog
chmod +x trans_watchdog
I am using most recent code as of 9/8/2008 9:50PM and below is my output
Script : trans_watchdog PID: 23470
Script Running: 0
SOURCE: /shares/internal/PUBLIC/Torrent/source
WORK: /shares/internal/PUBLIC/Torrent/work
TARGET: /shares/internal/PUBLIC/Torrent/target
USER: root
DATA USER: www-data
DATA GROUP: www-data
Transmission is running
SMB cpu:
Samba is idle
Transmission doesn't need to be started... it was still running
localhost:9091 responded: "success"
Tranmission is downloading: 1
FILE NAME.avi is already moved
File: FILE NAME.avi
File age: 96084
FILE NAME.avi is not old enough to remove (seeding for 26 hours), keep seeding
ID: 10
Ratio: 0.1
FILE NAME.avi seeding ratio is less than 1.5 ratio (0.1), keep seeding
[root@MYBOOKUSER bin]#
Hi Frater,
Using the latest script I think you did it! Now everything seems working again, still need to test if using samba though.
Question: I had to edit the script at DATA USER, change www-data in my username; however, how should I change DATA GROUP, this gives an error: invalid group
Also, when transmission doesn't response, could it be an idea to restart it, like (changed a little based on your script, does it make sense?):
${TRANSREMOTE} ${TRANSOPTS}
if [ "${?}" -ne "0" ] ; then
echo "Restarting Transmission, it doesn't respond"
killall transmission-deamon 2> /dev/null
sleep 60
$TRANSSTART
exit 1
fi
edit:
When I stop transmission, and check if the script will start it again it still reports "
DATA GROUP: www-data
Transmission is running
SMB cpu: 0.0
Samba is idle
Transmission doesn't need to be started… it was still running
transmission-remote: (localhost:9091) Error
Using ps ax | grep transmission | grep -vc grep at the command prompt gives 0, still it reports transmission is running ??????
didn't you rename your script to transmission_watchdog?
If so… it is seeing the script instead of the daemon…..
The script is now capable of keeping the transmission-daemon running. It will not make a difference now if you rename the script.
Well, you were right, this renaming of mine was probably the problem.
My script seemed to work at commandline, but using cron something went wrong. In the line
IS_RUNNING=`ps -efu ${USER} | grep "${SCRIPT}" | grep -v grep | grep sh | grep -vc ${PID}`
I introduced a space between efu and ${USER}, and now this is working.
However, when using samba, the script still returns:
DATA GROUP: www-data
I will try to keep transmission running
Transmission is running
SMB cpu: 0.0
Samba is idle
Transmission doesn't need to be started… it was still running
I guess there is still a problem with the samba activity test.
Example of the screen after top (upper 4 lines):
210 ecori 18 10 14320 4696 4100 R 20.0 15.6 25:07.48 transmission-da
208 ecori 19 10 14320 4696 4100 R 17.0 15.6 29:19.18 transmission-da
486 ecori 14 0 860 656 656 R 13.0 2.2 14:59.93 smbd
678 ecori 13 0 628 628 476 R 4.0 2.1 0:00.14 top
Thanks for your help, I appreciate it!
Using 'top' to determine the CPU-usage is my own 'invention', but this method turns out to be less portable…
I will write a new one which is more portable
I think I have a good one now….
Do try this version…
I tried to get the CPU-performance with ps, but this didn't give me proper results…
I went back to top, but this time I let the program find the position of the CPU column….
Do check if it now really detects the CPU-level
Hi frater,
The script started fine at the commandline, but from cron I always got the message "already running" The reason for always running was possibly because the run controlscript saw itself! I changed it by using this script, based on your commands:
#!/bin/sh
##############################################################################
## test script to check the activity of trans_watchdog
## make a cronjob: vi /opt/etc/crontab; add: */5 * * * * ecori /opt/etc/trans_test
DEBUG=1
PID=$$
debug ()
{
if [ -n "$DEBUG" ]; then
echo 1>&2 $*
fi
}
WATCHSTART=/opt/etc/trans_watchdog
#test if trans_watchdog is running
IS_RUNNING=`ps -efu ${USER} | grep "trans_watchdog" | grep -v grep | grep sh | grep -vc ${PID}`
debug "Script : trans_watchdog; PID current trans_test script: ${PID}"
logger -s "Script trans_watchdog Running: ${IS_RUNNING}"
if [ "${IS_RUNNING}" -eq "0" ]; then
logger -s "trans_watchdog not running… I will start it"
$WATCHSTART
exit 0
fi
if [ "${IS_RUNNING}" -gt "0" ]; then
logger -s "trans_watchdog already running… it will stop"
fi
This works fine now, although probably you could do a better job ;)
The check if samba now detects the CPU level is not yet ok, the script finds the right coordinates, because the line echo "$CPU_POS $CPU_END" detects the right positions in the top header. However, it still claims samba is not running, when I use it alot. I guess the problem is in line
SMBcpu=‘top -b -n5 -d0.5 -u${DATAUSER} | grep smbd | cut -b${CPU_POS}-${CPU_END} | sort | awk ’NR == 3' | tr -d ' '
Could it be with the cut command? is it looking at the right column now?
We're getting very close now in getting a good working script!
I will take a look at the difference between your code and mine.
BTW… You do know it is working on my platform, do you?
What does this command return if you run it from commandline?
export DATAUSER=ecori
export CPU_POS=42
export CPU_END=45
top -b -n1 -u${DATAUSER} | grep smbd | cut -b${CPU_POS}-${CPU_END}
Does it need a space between -u and ${DATAUSER} ???
Maybe your top is unusable because it doesn't work with spaces?
Do try and find the positions of cpu-level…
Hi, this is my output using from the commandline:
export DATAUSER=ecori
export CPU_POS=42
export CPU_END=45
top -b -n1 -u${DATAUSER} | grep smbd | cut -b${CPU_POS}-${CPU_END}
27.5
0.0
0.0
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3543 ecori 9 0 624 304 300 R 35.4 1.0 36:54.43 smbd
2544 ecori 20 19 15944 6416 5872 R 4.5 21.3 115:39.73 transmission-da
91 ecori 9 0 0 0 0 R 4.3 0.0 9:53.25 usb-storage-0
4978 ecori 13 0 668 668 508 R 1.3 2.2 0:00.40 top
I noticed the numbers 42 and 45 as the values returned for CPUpos and CPUneg.
Thanks, and of course it is working on your platform otherwise you wouldn't post would you!
tested it alsow with a space after -u, gives similar result.
The problem with your platform is that it will give more than one result with top. On our platform it will give only the session with a workload. The other sessions run as root.
It doesn't matter…
I will write around it….
edit: just did ( added a grep -v "0\.0" )
please download again…
edit: it should have been " grep -v " 0\.0" of course
please download again ;-)
I did look at part of your code and saw some lines didn't make sense…
I will get back to you on that. (I'm at work now)
BTW… I do realise that it's possible one or more of the 5 samples return 0% cpu and it will in that case give 0 or maybe the highest one of the samples. But in any case it will always return a value that was true at a certain time. With this code I will almost always find an average (median) result. It's always better than only 1 sample.
I might ditch the part in which it tries to find the column of the CPU percentage. I'm almost certain it's always 42….
I really don't know what you are trying to do with "WATCHSTART".
The only reason for having that part of the code is to prevent the script from running twice.
During its execution it shouldn't be allowed to run again.
Before, I did this with a lockfile, but this lockfile has to be removed at the end of the script. If the script somehow crashes before ending, it will never execute again. To prevent this, you can remove the lockfile in the case it runs for a 2nd time. But then it is possible to run the script again, and it will not stop, because the lockfile has been removed.
YES! that did it! Samba is going idle when it is highly active, it reported SMB cpu: 24.9, and shutdown transmission and eded the script. Great.
I defined WATCHSTART to start trans_watchdog, the same as you used TRANSSTART. If I used your script I always got back that the script was already running, which reminded me of your remark before "it is seeing the script .."I thought, possibly it sees itself running, so when the script checks if trans_watchdog is running, of course it gets a positive result. Therefore I reasoned if another script (named trans_test, because it was testing by me if this would work, better rename now) could test if trans_watchdog is running,then I avoid the problem of seeing itself. The funny thing is, it worked fine from the commandline, but not using cron. Now everything works great, many thanks. I never programmed anything in linux, did some pascal when I was a student, so plenty of commands I don't understand. What is not clear to me is why you use DATAUSER and DATAGROUP, because DATAUSER is in my case the same as USER. Possibly to make it more flexible… The DATAGROUP value is still www-data in my script, and doesn't interfere, but I don't know what it is for!
I have learned alot during this brainstorming, I would never figured it out by myself, thanks again!
Ecori
edit:
just after posting this message I got somebody trying to get access on my FTP server:
Sep 11 20:59:45 vsftpd[6112]: CONNECT: Client "213.195.223.197"
Sep 11 20:59:45 vsftpd[6111]: [www-data] FAIL LOGIN: Client "213.195.223.197"
Sep 11 20:59:46 vsftpd[6111]: [www-data] FAIL LOGIN: Client "213.195.223.197"
Sep 11 20:59:48 vsftpd[6111]: [www-data] FAIL LOGIN: Client "213.195.223.197"
So, I changed the data! No use trying again whoever tried…..
but you are starting the watchdog while the whole intention of the check is that it should NOT run…..
If it doesn't work properly, it is better to just delete that part of the code…
normally it only runs every 5 minutes… plenty of time to finish (unless you are using unrar)
Isn't it better to find out why it isn't working?
I can probably write the code a bit different, so it will run on "all" systems.
Agreed, so we can continue. The script all toghether takes on my router (I run the script on an Asus router, with custom firmware) appr. 16 minutes (without the rar function). It takes this time, since the response when transremote tries to communicate with transmission is very slow.
I thought I fixed it myself :(, but not true….
I made a small testscript, based on the start of your big one…. it only contains the test for running test part, and I made it as a cron job to run every 5 min.
part of the test script (based on your commands of course:)
.
.
IS_RUNNING=`ps -ef | grep "${SCRIPT}" | grep -v "$0" | grep -vc grep`
logger -s "Script : ${SCRIPT} PID: ${PID}"
logger -s "Script Running: ${IS_RUNNING}"
IS_RUNNING=`ps -efu ${USER} | grep "${SCRIPT}" | grep -v grep | grep sh | grep -vc ${PID}`
logger -s "Script : ${SCRIPT} PID: ${PID}"
logger -s "Script Running: ${IS_RUNNING}"
if [ "${IS_RUNNING}" -gt "0" ]; then
logger -s "${SCRIPT} already running… it will stop"
exit 0
fi
…. some other logger -s activities to check of the script continues……
response after cron task (the response from commandline are both the same):
Sep 12 09:45:06 ecori: Script : test_start PID: 9379
Sep 12 09:45:06 ecori: Script Running: 0
Sep 12 09:45:07 ecori: Script : test_start PID: 9379
Sep 12 09:45:07 ecori: Script Running: 1
Sep 12 09:45:07 ecori: test_start already running… it will stop
However, the response now for script running is always 0, I am too stupid with this to fix it…. I don't understand the grep commands.
edit:
another problem still: when inserted in trans_watchdog, and executed from that script,
logger -s "Script : ${SCRIPT} PID: ${PID}"
still reports: Script : trans_test PID: 9717
I guess, this is caused by my test, when I inputed: export: SCRIPT=trans_test
FIxed it for now by replacing
grep "${SCRIPT}"
by grep trans_watchdog
Hi, i have transmission installed via optware (with clutch) and dont have S90transmission, can you give me advice if i can use your script? :)
thanks
The following make sure you have the proper scripts in place…
It will make a startup script for optware, if yours is missing…
This should put everything magically in place….
BTW…. The last few days my proxy has been pointing to an old version of the script… redownload to make sure you have the proper script….
cd /etc/init.d
[ ! -e S90optware ] && wget http://wd.mirmana.com/S90optware
chmod +x S90optware
cd /opt/etc/init.d
rm S90transmission
wget http://wd.mirmana.com/S90transmission
chmod +x S90transmission
ln -s S90transmission K90transmission
cd /usr/bin
rm trans_watchdog
wget http://wd.mirmana.com/trans_watchdog
chmod +x trans_watchdog
[ `grep -c trans_watchdog /etc/crontabs/root` -eq "0" ] && echo -e "\n# Watch Tranmission every 5 minutes\n*/5 * * * * /usr/bin/trans_watchdog" >> /etc/crontabs/root
thanks!, i had S90optware, so thank you for the rest
so my transmission is started from init.d > post_network .. etc.
so transmission was running and downloading
i've tried to run your script and got this:
Script : trans_watchdog PID: 1040
Script Running: 0
SOURCE: /shares/internal/STORAGE/_downloads/_torrents
WORK: /shares/internal/STORAGE/_downloads/_tmp
TARGET: /shares/internal/STORAGE/_downloads
USER: root
SCRIPTNAME: /usr/bin/trans_watchdog
DATA USER: www-data
DATA GROUP: www-data
I will try to keep transmission running
Transmission is running
42 45
SMB cpu:
Samba is idle
Transmission doesn't need to be started… it was still running
transmission-remote: Unable to parse response "Error: 401
"
transmission-remote: Unable to parse response "Error: 401
"
Tranmission is downloading: 0
Tranmission is not downloading… I will set the download directory
transmission-remote: Unable to parse response "Error: 401
"
transmission-remote: Unable to parse response "Error: 401
"
transmission-remote: Unable to parse response "Error: 401
"
how i can figure out if it is working? :)
Somehow your transmission-daeomon expects authentication.
I haven't experimented with that, although I will in the near future….
Or you disable authentication in the daemon ( -n ) or you submit it in transmission-remote (TRANSREMOTE="/opt/bin/transmission-remote)….
How did you enable authentication?
Do redownload the script…. I changed it to make it respond more properly…
Do check that first before you fix the authentication…
Please post the output of the script
hi, thank you
if transmission is NOT running, it works fine
if it is running and i try run watchdog i've got this:
Script : /usr/bin/trans_watchdog PID: 31350 Version: Sun Sep 13 13:00:04 CEST 2008
Script Running: 0
SOURCE: /shares/internal/STORAGE/_downloads/_torrents
WORK: /shares/internal/STORAGE/_downloads/_tmp
TARGET: /shares/internal/STORAGE/_downloads
USER: root
SCRIPTNAME: /usr/bin/trans_watchdog
DATA USER: www-data
DATA GROUP: www-data
I will try to keep transmission running
Transmission is running
invalid option
Transmission 1.33 (6608) http://www.transmissionbt.com/
A fast and easy BitTorrent client
Usage: transmission-remote [host] [options]
transmission-remote [port] [options]
transmission-remote [host:port] [options]
See the man page for detailed explanations and many examples.
Options:
-h —help Display this help page and exit
-a —add Add torrent files
-b —debug Print debugging information
-d —downlimit <speed> Set the maximum download speed in KB/s
-D —no-downlimit Don't limit the download speed
-er —encryption-required Encrypt all peer connections
-ep —encryption-preferred Prefer encrypted peer connections
-et —encryption-tolerated Prefer unencrypted peer connections
-f —files List the current torrent's files
-g —get <files> Mark files for download
-G —no-get <files> Mark files for not downloading
-i —info Show details of the current torrent(s)
-l —list List all torrents
-m —portmap Enable portmapping via NAT-PMP or UPnP
-M —no-portmap Disable portmapping
-n —auth <auth> Set username for authentication
-p —port <port> Port for incoming peers (Default: 51413)
-ph —priority-high <files> Set the files' priorities as high
-pn —priority-normal <files> Set the files' priorities as normal
-pl —priority-low <files> Set the files' priorities as low
-r —remove Remove the current torrent(s)
-s —start Start the current torrent(s)
-S —stop Stop the current torrent(s)
-t —torrent <torrent> Set the current torrent(s)
-u —uplimit <speed> Set the maximum upload speed in KB/s
-U —no-uplimit Don't limit the upload speed
-v —verify Verify the current torrent(s)
-w —download-dir <path> Set the default download folder
-x —pex Enable peer exchange (PEX)
-X —no-pex Disable peer exchange (PEX)
SMB cpu:
Samba is idle
Transmission doesn't need to be started… it was still running
transmission-remote: Unable to parse response "Error: 401
"
Tranmission is downloading: 0
Tranmission is not downloading… I will set the download directory
transmission-remote: Unable to parse response "Error: 401
"
transmission-remote: Unable to parse response "Error: 401
"
transmission-remote: Unable to parse response "Error: 401
"
TRANSOPTS is "-m -b -n"
and i have no idea about transmission-remote as i've installed ipkg install transmission and then set it up via config
tip for you:
can you change script that it is possible to read dir from transmission.conf ?
thanks for your time
make TRANSOPTS "-m "
There's not a real problem getting the workdir from transmission, but it then needs the place of the configuration-dir
The HOME variable could be different than that of the watchdog…. and what about the source-dir and target?
I will implement it, I think, but will wait for other issues first…
I just got a great deal on a 1.5 TB World II ($389 with a $200 Instant savings = $189) and, of course, the first thing i did was void the warranty by enabling SSH and configuring the system the way I want it, as it should be.
I just started using your script and, it is proving to be very handy, but, i have some suggestions, and a bug report.
First, the bug report, your watchdog script uses K10transmission as the shutdown script, but, in your instructions, you say to name the link K90transmission….. Am I missing something?
Suggestions: First off, it would be nice if all the configuration was done in a separate file, or at the beginning of the script. I waited for the download to stop sometime after the ratio hit 1.4, well, I waited and waited, and pretty soon the ratio was up to 3.5, I finally realized that I had to set RATIO=1, and it has been working pretty nicely since. My second suggestion is to throttle the download/upload speed (configurable, of course) when Samba is accessed, and not stop the daemon…. (if this is possible)
Also, a request, if anyone out there knows a good rss downloader script (torrent and non torrent) I would be very grateful….. I'm currently using utorrent on another computer to grab the .torrent file and drop it in the auto get directory of transmission, and I'm using CITA RSS aggregator for some podcasts I get by RSS and would like to move both to the MBWE so I can shut my computer off and still get my latest podcasts and TV shows.
Thanks in Advance.
First, the bug report, your watchdog script uses K10transmission as the shutdown script, but, in your instructions, you say to name the link K90transmission….. Am I missing something?
No… you're not missing something… I was!
S90… means the service will be started quite late and this means one should stop it before another service it might depend on is getting stopped…
I decided to name that symbolic link K10transmission
If I find the time I will try to implement your suggestions. The separate config will probably be the first…
Of course it's possible to throttle the daemon instead of killing it, but I'm killing it to free resources (memory and CPU) and throttling will lower the resources but maybe not enough….. If you promise to give me feedback on that I will get into that….
I'm glad it can be made to run on other systems.
My friend's worlbook crashed recently and now I implemented transmission and this script on his Asus WL-500G deluxe router with a 1 TB USB harddisk and it works…..
BTW… Are you also using mvmovie and mkdvd?? I love to get feedback on that….
So, you are saying I should recreate the link as K10 instead of changing the line in the script to K90, as I did?
I'd be glad to try out the throttling, especially if it's possible to limit the BandWidth during certain hours, and go full speed during others, as I was doing with utorrent, because I have Vonage as my phone service, and when torrents take up too much BW, the person I'm talking to complains that it's too choppy.
I'm not using the other scripts, mainly because I haven't read through them thoroughly, and there is no documentation on them that I can find, but, if I find them to be useful, I'm sure I will.
I'm a bit of a programmer myself, although, I don't have a whole lot of shell script experience, and, if I make any modifications to your script, I'll be sure to share my changes with you.
Also, did you see my comment on your other thread about the log? I see in some comments above
Script : /usr/bin/trans_watchdog PID: 31350 Version: Sun Sep 13 13:00:04 CEST 2008
Script Running: 0
SOURCE: /shares/internal/STORAGE/_downloads/_torrents
WORK: /shares/internal/STORAGE/_downloads/_tmp
TARGET: /shares/internal/STORAGE/_downloads
USER: root
SCRIPTNAME: /usr/bin/trans_watchdog
DATA USER: www-data
DATA GROUP: www-data
etc. and I don't know where to get this from.
Yep, make a link to K10transmission (otherwise transmission will not get stopped by the script)
I have made the change about throttling and you can download it now. However….. I thought you wanted it to throttle during SMB-transfers, but according to your last post you want scheduling…. I can do that too, of course….
Don't you have QoS on your router?
the info you mentioned will only go to stdout and you will see it when you run it from command-line. On full linux systems with procmail support you can get them mailed to yourself, but I guess you are running it on a worldbook as I am.
The other info is written to the syslog and this means /var/log/messages on a normal system….
Can you test the current version already?
I will look into scheduling now.
Please redownload….
I just finished scheduling…..
Might look into more advanced scheduling (weekdays / weekend )
18:09 CET (finished weekdays / weekend as well)
Please test
18:23 CET (made up/down ratios for schedule independent from the smb)
I'm stopping for today….
I did notice the script doesn't work anymore on my friend's router because its busybox has no support for arrays :(
If I rewrite that code and use awk instead of bash it can be made portable again… I'm leaving it now for today.
If anyone wants to rewrite that portion for me, he's welcome…
Others… stay tuned.
BTW. It runs fine on my worldbook
Wow, I have been away (two sons in baseball) and haven't had a chance to try anything yet, nice how you have done so much.
But, I had a problem with the script I had already, and I don't know if I can provide enough info to figure out what happened, exactly, but, it looks like a file that was fully downloaded disappeared after it finished, and didn't even get a *.info file made for it… I'm going to rename the .torrent and see if it happens again… After I get the new script.
I went ahead and got the rest of the scripts (mvmovie mkdvd and imdb) can you point me to some documentation, or, at least describe their functions here?
Edit: I think I found one problem already, it doesn't seem to start transmission if it's not running now…..
Edit2: Seems it was because I changed /bin/sh to /opt/bin/sh and don't have that installed
bash: /usr/bin/trans_watchdog: /opt/bin/sh: bad interpreter: No such file or directory
I did /opt/bin/ipkg install bash and it installed, but, I still get this error, do I need something else?
Edit3: I changed it back to /bin/sh and, renamed the .torrent, and it is downloading (and the throttling is in effect, although, I need to change the values) we'll see if the file disappears this time….
Edit4: It seems there is something wrong, but, I'm not sure what it is, or where the problem is… the file started downloading, has 7 seeders, but, isn't downloading at all now.
Edit5: Seems setting the download rate to 0 disables it rather than making it unlimited…….. You might want to debug that part a little….
I don't know which hardware you're running it on, but if your busybox has normal LFS (like the worldbook) you should keep the first line #!/bin/sh
In the recent past I also changed the code, so special characters are removed and spaces replace with dots. Please let me know if things are running as they should.
See my last edits…….
Also, that external config file would come in handy when getting a new version…. changing the options every time is boring. :) Great job, though.
The spaces to dots thing should be configurable, as well as the rest of the renaming process, All my other files have spaces, so, I will have to rename all of them to keep them consistent…..
For instance, I organize my Public Domain TV shows like this:
/shares/internal/TELEVISION/Name Of Show/01x01 - Pilot.avi <-notice the show name is only in the directory name, not in the actual filename.
problem is, not all of them are named the same way, and most of them don't have the episode title in the original filename, so, that would have to be looked up similar to your imdb script.
Edit5: Seems setting the download rate to 0 disables it rather than making it unlimited…….. You might want to debug that part a little….
Setting to 0 makes it UNLIMITED, but only for the full_throttle
When you set it to 0 in schedule or for samba, it means 0 throughput….
This is intended.
Tell me if you still think it doesn't work as it should…..
- transmission can also be throttled using a schedule
SCHEDULE_THROTTLE_UP=20
SCHEDULE_THROTTLE_DOWN=2000
when set to 2000, it works, when set to 0, it stops working. I guess this is as intended, but, I thought 0 would mean unlimited here, as well… guess I was wrong.
I can also change the code to make 0 as unlimited and a negative number as stopping….
But in the mean time I discovered a bug because I wasn't aware that there are 2 functions for the "day of the week" namely
date +%w day of week (0..6); 0 is Sunday
date +%u day of week (1..7); 1 is Monday
Due to this bug, the code will not work today (sunday=7 and 7 is out of bound as arrays go from 0 to n not 1 to n) and it was a day off all the time.
I also changed the code, so you can easily run the whole code every 5 minutes or 3 minutes (using INTERVAL)
Well… that's the problem with running very fresh code…..
No Problem, I got your latest script and pulled all of the config options I felt were appropriate into a .conf file placed it in ~/ added ~/trans_watchdog.conf to the end of the command in crontabs and use . $1 in the script to run it, it seems to work. I know this is a quick, dirty hack, but, unless you have a better, more elegant way of doing it, this would allow me to update the script whenever you update it, and not have to edit the script every time… I'm sure you could probably whip up something fancy, like a config script that would take input for creating the file, and allow you to make changes (add new options) without erasing all the options every time.
Yes….
I will look into it (bit of googling how others do such a thing).
I used to be a fulltime programmer (self-taught) and I just recently started doing shell-scripts.
As an example..
The code using "top" to determine if a process is busy can't be found on the net and is my own "invention".
AFAIK it gives more reliable info than other examples that are doing the same thing…
I wanted to do a full cleanup of the code, but it just isn't as rewarding as new features.
Now the script is getting more and more ugly…..
Hang on for an update….
I have an associates degree in the field of computer programming, but, that doesn't really mean much :)
I was just wondering, if I remove a file from the webif of transmission, will trans_watchdog remove the sym link for it on the next run?
I guess I'll try that now…
Edit: looking through the script, I see you have already thought of that :)
Doesn't seem to have worked, but, i have a second file still seeding, maybe the code needs some tweaking?
Edit: Oh, wait, that's in the part of the script that runs every 5 minutes, guess I need to wait to see…
Edit: Yes, it did work, eventually.
configfile is done
I didn't really get any wiser googling for a best practice for my config-file, so I "invented" my own way of doing it.
As I wrote it, I can still introduce new variables without getting an error.
If things really don't work as expected one can still kill the config file which is written to /etc/trans_watchdog.conf or /opt/etc/trans_watchdog.conf (or optionally another file using "-c" trans_watchdog -c /opt/etc/trans_watchdog.conf)
I had some problems with the array-variable which couldn't be handled like any other variable as it turned out….
But everything is working now!!
I feel you have missed some options…
SOURCE=
WORK=
TARGET=
RUN_AFTER_MOVE=
FILE_AGE=1
RATIO=1
They are all in the script, and I may be misunderstanding the last 2, but, the first three are critical for me…
SOURCE
WORK
TARGET are all created from BASEDIR
I guess you're not using the structure
/source
/work
/target
RUN_AFTER_MOVE was not working somehow (although I'm not sure about that) so I deleted it.
FILE_AGE is not a config-var but is calculated
RATIO is not a config-var but is calculated
integer expression expected 132: [: 0
integer expression expected 134: [: 30
transmission: SOURCE directory /shares/internal/JUNK/Torrent_Temp/!!!AutoGetTorr does NOT exist, script will exit
the SOURCE directory is actually /shares/internal/JUNK/Torrent_Temp/!!!AutoGetTorrents (I also tried /shares/internal/JUNK/Torrent_Temp/\!\!\!AutoGetTorrents) seems to be getting cut off for some reason.
The other errors are from lines 132 and 134 as the error points out, but, I don't know what the problem is.
I guess you have been using some windows app to edit that file?
Can you check trans_watchdog.conf for strange characters?
You can also enclose it between double quotes..
But why the preference for these strange characters?
If nothing helps you should delete the config file and afterwards edit it with vi to modify the parameters….
No, I didn't use any windows app to edit it. I did, however add it to my webif so i could edit it from there, and, I guess it must have added crlf EOLs I'll modify it to run dos2unix after editing :)
Edit: dos2unix seems to have done it, thanks.
Can you give some feedback about the throttling during SMB-activity?
I'd like to know if it's sufficient….
Of course you need to publish the values you used for throttling…
I never had too much of a problem with torrents interfering with SMB activity, even with 3 Xboxes watching different movies at once, and my main PC transferring new movies/TV shows to the My Book….. But, I do see the messages that it is throttling for SMB activity.
Like your request for a schedule, this smb-throttling was a request as well…
I think it's more transmission's CPU-usage & memory consumption which is interfering and I can only hope it's behaving more nicely when the throughput is throttled.
Can you give some feedback on how my script in general can be implemented now and how it's running?
I'm not sure what you mean by how it can be implemented.
Edit: remove a mistaken conclusion….
Well, the script has been running rather well, but, today I had a situation (twice, actually) where the MBWE froze, looking at /var/log/messages.0 it looks like an out of memory problem… So, I was thinking, since the new script doesn't stop/start transmission, maybe something could be added that would keep track of memory, and restart transmission when it gets low or something (like pausing some torrents, or whatever might decrease memory usage).
sounds like a memory leak which is a problem with the daemon itself.
I can however kill the daemon whenever it doesn't react on 'transmision-remote' or when it doesn't download one byte.
How was your transmission behaving in that situation?
BTW…. You should try an ipkg update / ipkg upgrade…. A lot has been updated and transmission_1.52-1 is one of them.
the whole thing locks up, the LED stops flashing (and stays lit up in whatever way it was at the moment of the crash until I unplug it) my SSH session gets disconnected, etc.
upgraded.
I was looking at another script that works similar to yours, and saw a few things you might consider adding, such as
- how many torrents should be downloading at the same time
- recommended to keep this at 1, since mbwe does have so little memory and so slow cpu
MAX_SIMULTANEOUS=1
and
- whether or not to quit transmission, if there are no torrents in the queue.
- if quit, it will be restarted when something is found in the watch directory
- if you're planning on adding torrents also by other means (with clutch, for example)
- than using the watch directory, set this to 0
QUIT_TRANSMISSION_WHEN_INACTIVE=1
I was already considering the latter…
I'm actually already doing something when transmission is inactive…
MAX_SIMULTANEOUS is implemented (please test)
I have added QUIT_TRANSMISSION_WHEN_INACTIVE, but it will probably turn transmission on and off all the time…. (quick and dirty implementation)
Have to think of a procedure to prevent that.
I'm considering to revert the whole code that contains "QUIT_TRANSMISSION_WHEN_INACTIVE" as I can't oversee every situation and I can't be sure that it will not get in a situation that it either stops and starts every time or doesn't start again at all….
I will however incorporate the code with MAX_SIMULTANEOUS….
When MINUTE=0 I will stop the daemon only if it's not downloading anything….
It will restart after 5 minutes….
It only does this if it's also able to start the daemon (KEEP_TRANSMISSION_RUNNING=1)
please test
I'm sure you don't want to steal someone else's code (although, in open source, it's not stealing as long as you give proper credit) but, did you find this other script and see how he does the QUIT_TRANSMISSION_WHEN_INACTIVE stuff? I haven't tested the other script at all, but, just reading the code, it looks pretty straight forward.
I'll update and check out the new script when I get a chance.
After introducing your feature requests I introduced some bugs which caused it to remove the symbolic links of already downloaded files….
The script was thinking it had nothing to download, when in fact transmission was stopped.
When transmission then starts again it will start to download the torrent again and will get in an error-state when it tries to copy the newly downloaded torrent….
Please update your scripts and manually clean up the work directory and target directory… !
updated, I'll let you know if I see anything wonky, I had noticed that it seemed completed downloads were finishing before they had been seeding for the correct amount of time, but, I assumed I was just mistaken, since I didn't have the time to really check it out. I do notice that you seem to have forgotten to update the scriptver variable the last few updates… :)
OK, I have been busy, so, I couldn't get on here or even watch the script closely, but, I noticed something, you use
transmission-remote -l 2>/dev/null | grep -v "ETA " |grep -v "^Sum:" | wc -l
to return number of downloads, I see two things wrong, first (and very minor, makes no real difference) that 2 must be a typo, second, it counts all torrents as downloading, even if they are actually done and are only seeding… I think it would be better to check the Done column instead, and ignore any that are 100%, or ignore ones in the ETA column that say Done….
Edit: I see now why the 2 is there, it's not a typo… :) but, I added | grep -v "Done " after | grep -v "ETA " and it looks like it properly reports the correct number now.
Edit2: Maybe another check could be done to limit the number of seeding/idle torrents as well.
Edit3: I'll tell you what, though, if the MB is going to keep locking up, I might scrap this whole thing and either go back to running utorrent on my PC and set the download directories to the MB, or find an old computer to install Linux on (in fact, I already have an iMac I installed Ubuntu on, and don't really use….) and install transmission and this script on there, making any modifications I need to for it to run.
I'm still noticing a lot of torrents getting removed before they should be, might be related to the freezes, and having to unplug it and start it up again, but, it's rather annoying, and killing my ratio…
transmission-remote -l 2>/dev/null | grep -v "ETA " |grep -v "^Sum:" | wc -l
Nothing wrong there…
At that point I want to know if it is handling any torrents or not.
You are killing the logic when you exclude the seeding ones.
Please change it back if you want a proper behaviour.
If anything is wrong there, it's only the poor choice of naming the variable "DOWNLOADING"
I changed it to "HANDLING"… This doesn't effect the behaviour.
HANDLING=`${TRANSREMOTE} -l 2>/dev/null | grep -v "ETA " | grep -v "^Sum:" | wc -l`
I see now why the 2 is there, it's not a typo… :) but, I added | grep -v "Done " after | grep -v "ETA " and it looks like it properly reports the correct number now.
It's not about reporting at all.
The program should be running as a cronjob and its output is not that important (more for debugging)
I'm still noticing a lot of torrents getting removed before they should be, might be related to the freezes, and having to unplug it and start it up again, but, it's rather annoying, and killing my ratio…
Please run the unmodified script and tell me if it's still doing it.
If you want to change parameters, you should do this in /etc/trans_watchdog.conf or /opt/etc/trans_watchdog.conf
Also check if you installed findutils and other programs in optware (mentioned in header)
I don't want it Handling one file at a time, a file could be seeding for days, I want it only downloading 1 (or however many are specified in the limit setting) at a time, also, I have confirmed that when I stop transmission, or if I have to unplug the WB because it has frozen, that it removes seeding files because it thinks they are done
May 13 07:02:01 MediaServe user.notice transmission: Removed symbolic link Name.Of.File.avi because it was removed from transmission
it wasn't, I just shutdown transmission using the K10 script. what is even stranger is I had already removed the watchdog script from crontabs before this, meaning it was still run somehow…
And, yes, it is about reporting, it is about reporting to a part of the script later how many downloads are currently running, so it can either do nothing, or add another, before, it was reporting all files, not just the ones downloading.
And, yes, it was removing seeding tasks before I touched the script.
As far as making changes in /etc/trans_watchdog.conf or /opt/etc/trans_watchdog.conf, there is no way to change what I changed there.
and, yes, I installed all of the dependencies.
The ENTIRE reason I was editing the script is because it was freezing up with the unmodified script.
May 13 07:01:54 MediaServe user.warn kernel: transmission-da: page allocation failure. order:1, mode:0x20
May 13 07:01:54 MediaServe user.warn kernel: Mem-info:
May 13 07:01:54 MediaServe user.warn kernel: DMA per-cpu:
May 13 07:01:54 MediaServe user.warn kernel: cpu 0 hot: high 6, batch 1 used:5
May 13 07:01:54 MediaServe user.warn kernel: cpu 0 cold: high 2, batch 1 used:1
May 13 07:01:54 MediaServe user.warn kernel: DMA32 per-cpu: empty
May 13 07:01:54 MediaServe user.warn kernel: Normal per-cpu: empty
May 13 07:01:54 MediaServe user.warn kernel: HighMem per-cpu: empty
May 13 07:01:54 MediaServe user.warn kernel: Free pages: 1016kB (0kB HighMem)
May 13 07:01:54 MediaServe user.warn kernel: Active:3435 inactive:1053 dirty:93 writeback:0 unstable:0 free:254 slab:2329 mapped:3303 pagetables:95
May 13 07:01:54 MediaServe user.warn kernel: DMA free:1016kB min:724kB low:904kB high:1084kB active:13740kB inactive:4212kB present:32768kB pages_scanned:0 all_unreclaimable? no
May 13 07:01:54 MediaServe user.warn kernel: lowmem_reserve[]: 0 0 0 0
May 13 07:01:54 MediaServe user.warn kernel: DMA32 free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
May 13 07:01:54 MediaServe user.warn kernel: lowmem_reserve[]: 0 0 0 0
May 13 07:01:54 MediaServe user.warn kernel: Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
May 13 07:01:54 MediaServe user.warn kernel: lowmem_reserve[]: 0 0 0 0
May 13 07:01:54 MediaServe user.warn kernel: HighMem free:0kB min:128kB low:128kB high:128kB active:0kB inactive:0kB present:0kB pages_scanned:0 all_unreclaimable? no
May 13 07:01:54 MediaServe user.warn kernel: lowmem_reserve[]: 0 0 0 0
May 13 07:01:54 MediaServe user.warn kernel: DMA: 220*4kB 1*8kB 0*16kB 0*32kB 0*64kB 1*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB = 1016kB
May 13 07:01:54 MediaServe user.warn kernel: DMA32: empty
May 13 07:01:54 MediaServe user.warn kernel: Normal: empty
May 13 07:01:54 MediaServe user.warn kernel: HighMem: empty
May 13 07:01:54 MediaServe user.warn kernel: Swap cache: add 6546, delete 5328, find 1360/2056, race 0+0
May 13 07:01:54 MediaServe user.warn kernel: Free swap = 94692kB
May 13 07:01:54 MediaServe user.warn kernel: Total swap = 104312kB
May 13 07:01:54 MediaServe user.warn kernel: Free swap: 94692kB
May 13 07:01:54 MediaServe user.warn kernel: 8192 pages of RAM
May 13 07:01:54 MediaServe user.warn kernel: 400 free pages
May 13 07:01:54 MediaServe user.warn kernel: 691 reserved pages
May 13 07:01:54 MediaServe user.warn kernel: 2329 slab pages
May 13 07:01:54 MediaServe user.warn kernel: 2917 pages shared
May 13 07:01:54 MediaServe user.warn kernel: 1218 pages swap cached
I just did an ipkg update and ipkg upgrade, and it upgraded transmission to 1.61-1, I'll go find the change log and see if this is something fixed in the new transmission.
Edit: http://linux.softpedia.com/progChangelog/Transmission-Changelog-4856.html <-1.60 added a watch directory natively, and some other changes were added in other revisions that might be useful in your script, such as seed ratio limiting natively.
just a quick note, I set -gpr (global peers) to 25 and the CPU usage dropped suddenly from 75%-93% down to less than 40%, might have been a coincidence, but, I haven't seen that happen before I did that.
Whether you think I know what I'm doing or not, there is one thing you overlooked that causes unexpected behavior for sure.
When the script fills in the value for ${Downloading} (or ${Handling}) it stays the same for the rest of the code, which means this:
do
NEW_NAME=`echo "$TORRENTNAME" | sed -e 's/\x1b\[[0-9]\{1,2\}\(;[0-9]\{1,2\}\)$
if [ ! "${TORRENTNAME}" == "${NEW_NAME}" ] ; then
mv "${TORRENTNAME}" "${NEW_NAME}"
_logger "I renamed Torrent: ${TORRENTNAME} to ${NEW_NAME}"
TORRENTNAME="${NEW_NAME}"
fi
if [ ${DOWNLOADING} -lt ${MAX_SIMULTANEOUS} ]; then
$TRANSREMOTE -a "${TORRENTNAME}" >/dev/null
if [ "${?}" -eq "0" ] ; then
_logger "Added the Torrent: ${TORRENTNAME} to transmission"
# rm -f "${TORRENTNAME}"
mv "${TORRENTNAME}" "${TORRENTNAME}.transmission"
fi
fi
else
debug "Did not add ${TORRENTNAME}, because the limit of ${MAX_SIMULTANEOUS}$
fi
done
causes it to add ALL of the torrents, no matter what the limit is. you need to reassign that variable within the do, so it increases as new torrents are added, or do let "DOWNLOADING++" when you add a new torrent, or something….
Edit: OK, I see that later in the script it shuts down transmission if there are no active files, which is why it needs all active files, and not just the downloading files, so, I added (I haven't downloaded the new script, yet) HANDLING=your original line and left DOWNLOADING=my line and use DOWNLOADING to figure out whether or not to add a new download (with the let "DOWNLOADING++" I mentioned inside the do loop) and changed the name of the other ones to HANDLING, so, it works as you expected. I also think that setting -gpr as I mentioned earlier is really helping, I'm downloading more than one torrent without it freezing, whereas, it was freezing with just one download going before. so, maybe that should be added as another option in the conf, with either 0 or -1 as unlimited.
Edit2: Of course, HANDLING should be increased when you add a new one as well.
Yes, you are right. I should increment the value.
I wasn't in need of such a feature myself because I don't download that many torrents….
If transmission is bringing your worldbook down, you have to blame transmission itself, really.
I do hope you can run the modified script now.
Please tell me what you like to have changed so you don't need to edit it.
I also have to take care the script doesn't take up too many resources itself.
Especially the first bit shouldn't take too much as it runs every minute…
Because I need both values (handling and downloading), I added an extra line for HANDLING a bit further in the script.
That part only runs every 5 minutes and not every minute.
Well, I needed to edit it to test it before I could tell exactly what was wrong, if you have fixed it similar to what I have, then, I can discard my changes and use your script, unmodified.
now, new business (I still haven't gotten the latest, yet, but, I'm sure this will still be an issue) This is actually old business, I just never bothered to say anything before, every so often, it seems the script takes more than a minute to finish, or something.
May 13 12:54:01 MediaServe cron.notice crond[3010]: USER root pid 12430 cmd /usr/bin/trans_watchdog
May 13 12:55:01 MediaServe cron.notice crond[3010]: USER root pid 12529 cmd /usr/bin/trans_watchdog
May 13 12:55:07 MediaServe user.notice transmission: /usr/bin/trans_watchdog already running… this one will stop
May 13 12:56:02 MediaServe cron.notice crond[3010]: USER root pid 12648 cmd /usr/bin/trans_watchdog
like so. I have run it from the CLI many times, and it never takes more than a few seconds to complete, any idea what could be happening?
Edit: Also, is this supposed to be broken up like this? (I know nano will do this if you are editing a long line, and it is very infuriating)
(I had to add this line to allow it to indent properly in this codebox)
echo "From: <${MAILFROM}>
To: <${MAILTO}>
Subject: ${IP}: ${TORRENTNAME} torrent finished
" > ${TMPINFO}
cat ${INFO} >> ${TMPINFO}
I found a reason why script is not always working as expected.
I relied on transmission-remote to set a status code which I could use in my code.
It doesn't do so…
I will now change the code.
Hang on…
I have done some comprehensive moving in the script to minimize the time the script is running….
A DD-WRT router on which I was running the script as well behaved quite different and had to write some workarounds for that as well…
The program "transmission-remote" ran too often inside the script which slowed it down. Because writing this script is an evolutionary process it's quite normal to introduce these inefficiencies…
I hope you're having more success with the script now.
I wish you would update the Scriptver variable when you edit it, so i can tell when you have made changes since the last time I downloaded it, easily, I could probably even write an auto update script to run once a day or something, to keep it updated, or, at least let me know that a new version has been posted, so I can do it manually. :)
Edit: I just updated and now get this
May 14 07:02:01 MediaServe cron.notice crond[3010]: USER root pid 9161 cmd /usr/bin/trans_watchdog
May 14 07:02:02 MediaServe user.notice transmission: SOURCE directory /shares/internal/PUBLIC/Torrent/source does NOT exist, script will exit
May 14 07:03:01 MediaServe cron.notice crond[3010]: USER root pid 9190 cmd /usr/bin/trans_watchdog
May 14 07:03:02 MediaServe user.notice transmission: SOURCE directory /shares/internal/PUBLIC/Torrent/source does NOT exist, script will exit
It's not reading my config file, guess, but, I can't see any reason why. :(
Edit2: ran it from the CLI, maybe this is why:
/opt/etc/trans_watchdog.conf: line 34: unexpected EOF while looking for matching ‘’'
/opt/etc/trans_watchdog.conf: line 40: syntax error: unexpected end of file
but, I don't see any ' missing….
I just noticed transmissioncli (I don't recall seeing it before I upgraded transmission, although, i could be wrong) but, looking at it's help page
http://linux.die.net/man/1/transmissioncli
I see that you can specify a script to run on finish
-f, —finish script
Specifies a shell script to be executed upon successful download.
plus, some of the same settings you currently do with transmission-remote, I wonder if it would be useful to do some of the symlink stuff in this finish script, instead of your main script…
Before, I let the script decide if the conf should be placed in /etc or /opt/etc
I now fixed it to /opt/etc (you can still use the -c parameter to your own config-file)
In time I will look to transmissioncli
I hope thinks have settled down now (did do a lot of moving)
so, I need to move my config file, which is in /etc/ (because I have trans_watchdog in /usr/bin/) to /opt/etc/?
Yes, sorry
Made some more changes.
It executes transmission-remote less than before and doesn't continue when it left in an error-state.
This error-state is probably the reason why torrents are unwantedly removed…
Seems to be going OK, but, I still get some
May 14 22:19:02 MediaServe user.notice root: /usr/bin/trans_watchdog already running… this one will stop
although, it seems to happen a bit less.
Edit: make that a lot less…
So far, so good, I have even seen some messages saying that the torrent has reached (or exceeded) the ratio I set, and is being removed, as it should be, I still think you should look into using the built in seeding ratio limit, global Peers, and the finish script, 5 minutes isn't a terribly long time to wait, but, immediately could be better.. :)
No torrents downloading, but about 27 seeding, and
May 14 22:19:02 MediaServe user.notice root: /usr/bin/trans_watchdog already running… this one will stop
has not shown up once in the last few hours, so, i would say you have definitely improved it, as it was happening all the time (almost every 5-10 minutes) before, even with 1 or 2 seeding torrents and no downloading torrents.
and, since I set a limit on global peers (-gpr) I have not had one single freeze, and the CPU/MEM usage has greatly reduced.
I also did a change in S90transmission where I download a blocklist…
http://wd.mirmana.com/S90transmission
Although I'm not sure if it really helps in any way.
I guess it doesn't hurt to block some IP's
I've seen some mails from, for instance Sony, claiming someone was downloading content of their copyrighted material. I doubt if such a blocklist prevents this, but hopefully it makes it less likely….
This was going to be another of my suggestions, good deal.
Seems to be running very well now, and I just had another idea, pausing torrents that go an amount of time without any activity if there is a torrent waiting in the torrents directory, and, when all torrents have finished, unpause paused torrents, this would prevent a file with less than 100% available, or without any seeders, or whatever, from jamming up the queue…
May 17 07:40:15 MediaServe user.notice transmission: Invalid Torrent ID
getting a lot of this error, and still some of
May 17 07:35:07 MediaServe user.notice root: /usr/bin/trans_watchdog already running… this one will stop
when it's downloading… also, any idea how to suppress
May 17 07:37:01 MediaServe cron.notice crond[3010]: USER root pid 18466 cmd /usr/bin/trans_watchdog
I know it's running every minute as it should, so, I don't think it's necessary to fill messages up with these, is there some switch for cron that will prevent it from being logged?
I think unrar options should be added to config. I just downloaded my first torrent with rars in it (using this script), and, while I had forgotten to install unrar, and it failed, when I looked at your line in the script to see what options you used, I noticed a couple of things, one, it creates a directory using the filename, and, it unrars it to the same directory the rars are in (with the filename appended as the new directory) I'd prefer it unrarred to my final destination (since it won't be seeding it anyway), and possibly without creating a directory using the name of the original file. Although, that part might be OK, I'd rather be able to set those preferences.
I think you can surpress those messages, but I'm not sure.
I'm using a directory structure for my cronjobs, just like fedora does…
Maybe it can be done with the optware cron
I had to run another eventlogger to surpress these messages (syslog-ng).
I can't give you an exact howto as I did this a year ago and had to do some research before..
In /etc/inittab you have to disable the normal syslogd
#::respawn:/sbin/syslogd -s 400 -n -m 0
#::shutdown:/usr/bin/killall syslogd
and install with ipkg install syslog-ng a new one in optware…
I have this config for it:
cat /opt/etc/syslog-ng/syslog-ng.conf
#
# Syslog-ng example configuration for for NSLU2 Unslung 3.x
#
# Copyright (c) 1999 anonymous
# Copyright (c) 1999 Balazs Scheidler
# $Id: syslog-ng.conf 5159 2007-01-12 20:37:44Z fcarolo $
#
# Syslog-ng configuration file, compatible with default Debian syslogd
# installation.
#
options { long_hostnames(off); sync(0); };
source src { pipe("/proc/kmsg");unix-stream("/dev/log"); internal(); };
source net { udp(); };
destination authlog { file("/var/log/auth.log"); };
destination syslog { file("/var/log/syslog"); };
destination cron { file("/var/log/cron.log"); };
destination daemon { file("/var/log/daemon.log"); };
destination kern { file("/var/log/kern.log"); };
destination lpr { file("/var/log/lpr.log"); };
destination user { file("/var/log/user.log"); };
destination uucp { file("/var/log/uucp.log"); };
destination ppp { file("/var/log/ppp.log"); };
destination mail { file("/var/log/mail.log"); };
destination mailinfo { file("/var/log/mail.info"); };
destination mailwarn { file("/var/log/mail.warn"); };
destination mailerr { file("/var/log/mail.err"); };
destination newscrit { file("/var/log/news/news.crit"); };
destination newserr { file("/var/log/news/news.err"); };
destination newsnotice { file("/var/log/news/news.notice"); };
destination debug { file("/var/log/debug"); };
destination messages { file("/var/log/messages"); };
filter f_auth { facility(auth); };
filter f_authpriv { facility(auth, authpriv); };
#filter f_syslog { not facility(authpriv, mail, cron, user); };
filter f_cron { facility(cron) and not match("run-parts"); };
filter f_daemon { facility(daemon); };
filter f_kern { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_mail { facility(mail); };
filter f_user { facility(user); };
#filter f_uucp { facility(cron); };
#filter f_ppp { facility(local2); };
filter f_news { facility(news); };
#filter f_debug { not facility(auth, authpriv, news, mail); };
filter f_messages { not facility(auth, authpriv, mail, news, cron) and not program(syslog-ng); };
filter f_emergency { level(emerg); };
filter f_info { level(info); };
filter f_notice { level(notice); };
filter f_warn { level(warn); };
filter f_crit { level(crit); };
filter f_err { level(err); };
log { source(src); filter(f_authpriv); destination(authlog); };
log { source(src); filter(f_messages); destination(messages); };
#log { source(src); filter(f_syslog); destination(syslog); };
log { source(src); filter(f_cron); destination(cron); };
#log { source(src); filter(f_daemon); destination(daemon); };
#log { source(src); filter(f_kern); destination(kern); };
#log { source(src); filter(f_lpr); destination(lpr); };
log { source(src); filter(f_mail); destination(mail); };
#log { source(src); filter(f_user); destination(user); };
#log { source(src); filter(f_uucp); destination(uucp); };
log { source(src); filter(f_mail); filter(f_info); destination(mailinfo); };
log { source(src); filter(f_mail); filter(f_warn); destination(mailwarn); };
log { source(src); filter(f_mail); filter(f_err); destination(mailerr); };
log { source(src); filter(f_news); filter(f_crit); destination(newscrit); };
log { source(src); filter(f_news); filter(f_err); destination(newserr); };
log { source(src); filter(f_news); filter(f_notice); destination(newsnotice); };
#log { source(src); filter(f_debug); destination(debug); };
#log { source(src); filter(f_ppp); destination(ppp); };
Well, I have been rather busy and haven't had time to report anything (and, really, nothing has happened to report, until now) but, the last couple of days something strange has been happening, I noticed that the activity LED was not showing activity anymore, which meant (I thought) that it had finished downloading all of my torrents, or something, but, when I looked in the directory where I drop torrents, there were still many that hadn't had .transmission added to the end, so, I SSH'd in and ran top, no transmission binaries running… I then saw trans_watchdog start, and it was displayed as this: trans_watchdog <defunct> … What does this mean? I checked the SCRIPTVER variable against the one in the script on the site, and they matched. when I run trans_watchdog from the CLI, it displays no messages, at all, just closes silently. nothing in the messages log out of the ordinary, and transmission unfortunately doesn't create a log file, unless run in foreground mode, so, no help there. I start transmission manually, and it runs for a bit before closing again. I had read that this can happen on a drive with errors, bad clusters, etc., so, I shut down samba umounted the drives and ran fsck, it seemed to finish with no errors or anything, so, I don't know what it could be. I'm going to try to wget the script again, just in case, but, I doubt that will fix it.
Edit: I guess I'll have to wait, it seems the server that file is on is down..
Edit2: server came back, and I got it, no change, but, I think it may have something to do with bash.
Edit3: Seems my config file got set back to defaults, but, it wasn't complaining about not finding the correct directories… I think I have it fixed now.
Edit4: it seems bash from ipkg doesn't play well with trans_watchdog, I removed it, and now the script seems to be running better, and no more <defunct>
I'm getting a situation every so often where I have to edit the config file to get rid of options that aren't supposed to be added, such as path and pwd and a bunch of others, these variables cause the script to stop working correctly…
Yes, I have experienced it too and I can't find a reason for it.
I checked the code and will do that again now….
I'm considering to change all variables with some prefix and just save these variables instead of this "intelligent" way.
I changed the code and all variables now have a prefix so you'll need to edit /opt/etc/trans_watchdog.conf again…
Yeah, I noticed you had a new version, and saw all the variables renamed, and came over here to tell you I wish you would post a changelog somewhere, so I would know what I'm getting into before i update… :)
Sorry……
This watchdog wasn't meant as a serious project and I wrote it for myself in the 1st place.
I can recommend Examdiff to load your current version and the new version and look at the code to see what I've done with it…..
I didn't add any main features and all work I've done had to do with portability, sanity checks and bug fixes……..
You can also take a look at the new mkdvd, mvmovie and S90transmission where I also changed some code…
In mvmovie I try to detect TV-series and put them in a proper directory…..
Hi guys,
the http://wd.mirmana.com/ site is down. :-((( Can anyone let me have the content (S90transmission, trans_watchdog)? I just managed to get NTFS support for my added 2 TB, but managed to loose all my scripts and settings by not properly backing up before the firmware upgrade… Ouch.
Also, I am just curious, what would be the "canon" way of running transmission? An Optware install does not provide init.d scripts (nor a clear description of what one needs to do). If one of us is enthusiastic enough, it would be great to create a wiki page there (at transmissionbt.com) with a full howto (latest version is 2.11 by now).
Cheers,
Janos
OK, now it's back (the wd.mirmana.com site). Ehm, Frater, sorry to bug you again, do you use trans_watchdog with the latest transmission (2.11)? I don't want to start messing around with it if the transmission output is completely different by now anyway…
Thx,
Janos