Difference between revisions of "Let aMule restart on KAD disconnect"

From AMule Project FAQ
Jump to: navigation, search
m (fix markup)
 
Line 4: Line 4:
 
  #!/bin/sh
 
  #!/bin/sh
 
   
 
   
  if [[ `LC_ALL="C" amulecmd -P YOUR_PASSWORD_HERE -c status | grep 'Kad: Connected (ok)' | wc -l` != "1" ]]; then
+
  <nowiki>if [[ `LC_ALL="C" amulecmd -P YOUR_PASSWORD_HERE -c status | grep 'Kad: Connected (ok)' | wc -l` != "1" ]]; then</nowiki>
 
         /etc/init.d/amuled restart
 
         /etc/init.d/amuled restart
 
  fi
 
  fi

Latest revision as of 20:19, 15 October 2012

This HOWTO assumes that you have a working /etc/init.d/amuled script.

Put this in a file:

#!/bin/sh

if [[ `LC_ALL="C" amulecmd -P YOUR_PASSWORD_HERE -c status | grep 'Kad: Connected (ok)' | wc -l` != "1" ]]; then
        /etc/init.d/amuled restart
fi

Add this to your crontab (crontab -e):

*/30 * * * * PATH_TO_SCRIPT

This will check your amuled half-hourly and checks wether KAD is still running and if not restarts it.

I made this script, because I experienced often KAD disconnects.