FAQ amulecmd

From AMule Project FAQ
Revision as of 09:53, 15 April 2009 by GilesBathgate (Talk | contribs | merge | delete)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
English |

Deutsch

How can I configure amulecmd to schedule actions? (Linux)

You have to configure such jobs with crontab. Let's do it by example:

bash ~# crontab -e
00 6   * * * amulecmd -c "set bwlimit up 30"
00 22 * * * amulecmd -c "set bwlimit up 0"

Will set your download bandwith limit to 30 kb/s on 6:00am and unlimited on 10:00pm. For more possibilities see also aMuleCMD.

I cannot connect to aMuled. It seems aMuled does not create the listening port for connecting to it :-\?

You have probably not enabled External Connections in ~/.aMule/amule.conf

NOTE: You can create the value for ECPassword like that:

 echo -n yourpasswordhere | md5sum | cut -d ' ' -f 1

How can I receive a mail every day with a summary of the files amuled downloaded?

First, create this script and verify that it works properly. Then you can add it to your cron in the same way as shown above. Many cron-daemons will mail output of a script to your user. You can also use utilities like sendmail to mail the output of the script.

Usefull Scripts

Show downloads in a nicely formatted list

#!/bin/sh
amulecmd -c "show dl" | \
grep '.' | \
sed "1,/Succeeded/d" | \
sed -n "N;s/^ > .*[0-9A-F]\{32\} \(.*\)\n >.*\[\(.*%\)\].*]\(.*\)/\2 \1\3/p" | \
sort -n

Call amulecmd from the commandline without mess

#!/bin/sh
amulecmd -c "$*"

save this script as "amc" and chmod +x it, then you can call amulecmd like this:

./amc show log

or pipe the output into another program

./amc show log | grep completed

I find this slightly easier than the original

amulecmd -c "show log" | grep completed.


Search for results, until no more can be found

#!/bin/sh
echo Searching for $1
amulecmd -c "search kad $1" > /dev/null
prevres=-1
matchcount=0
for c in `seq 1 10`;
do
 sleep 5
 res=`amulecmd -c "results" | grep results: | sed "s/.*results: \(.*\)$/\1/"`
 if [ $res == $prevres ]
 then
  (( matchcount += 1 ))
  if [ $matchcount -gt 1 ]
  then
   matchcount=0
   break
  fi
 else
  matchcount=0
  prevres=$res
 fi
done