View Full Version : [aMule] init.d script per amuled
Mezzelfo
06-06-2005, 20:17
Mi date una mano a fare uno script da mettere in /etc/init.d per usare il demone di amule?
Quello che segue è una versione spolpata e modificata dello script presente nel wiki di amule.org per far partire amule con VNC.
amuled.sh
#!/bin/sh
#
# Startup/Stop script for aMuled - aMule Daemon
#
#Here, the choosen user to run amuled
theUser=
case "$1" in
'start')
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amuled"
;;
'stop')
;;
*)
echo "Usage: /etc/init.d/amuled.sh { start | stop }"
;;
esac
TO DO:
- controllo da mettere nello "start" che verifica che amuled non sia già in esecuzione.
- stop
- restart
Mezzelfo
07-06-2005, 16:22
Cosa ne dite di killall per lo stop?
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/killall amuled"
amuled.sh
#!/bin/sh
#
# Startup/Stop script for aMuled - aMule Daemon
#
#Here, the choosen user to run amuled
theUser=
case "$1" in
'start')
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amuled"
;;
'stop')
/bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/killall amuled"
;;
*)
echo "Usage: /etc/init.d/amuled.sh { start | stop }"
;;
esac
Psycotic
07-06-2005, 16:30
bah se amuled nn ha un comando specifico per stopparlo allora va bene..
Pr il controllo x vedere se e' partito ti basta un semplice
pippo='ps aux|grep /usr/bin/amuled' (non con qesti apici pero')
e poi fai il controllo x vedere se la variabile contieneun valore oppure no
Mezzelfo
07-06-2005, 17:23
amuled potrebbe essere eseguito da più utenti.
alreadyRunning=`/bin/ps -U $theUser -u $theUser u|grep /usr/bin/amuled`
if [ -n ${alreadyRunning} ]; then echo "amuled already running"; else /bin/su - $theUser -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amuled" fi
Mezzelfo
07-06-2005, 17:41
#!/bin/sh
#
# Startup/Stop script for aMuled - aMule Daemon
#
#Here, the choosen user to run amuled
theUser=
case "$1" in
'start')
alreadyRunning=`/bin/ps -U ${theUser} -u ${theUser} u|grep amuled`
if [ ${alreadyRunning} > " " ]
then echo "amuled already running"
else /bin/su - ${theUser} -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amuled -f"
fi
;;
'stop')
/bin/su - ${theUser} -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/killall amuled"
;;
*)
echo "Usage: /etc/init.d/amuled.sh { start | stop }"
;;
esac
EDIT
Il controllo per vedere se è già in esecuzione è inutile, ci pensa già amuled.
l'opzione -f è per metterlo in background.
#!/bin/sh
#
# Startup/Stop script for aMuled - aMule Daemon
#
#Here, the choosen user to run amuled
theUser=
case "$1" in
'start')
/bin/su - ${theUser} -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amuled -f"
;;
'stop')
/bin/su - ${theUser} -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/killall amuled"
;;
*)
echo "Usage: /etc/init.d/amuled.sh { start | stop }"
;;
esac
Mezzelfo
07-06-2005, 20:25
E' necessario installare amule-utils per avere amulecmd.
(# = comandi da root, $ comandi da utente che userà amule)
# apt-get install amuled amule-utils amule-remote-gui
$ amuled (questo genera il file amule.conf)
$ vi ~/.aMule/amule.conf
controllare che ci siano queste voci:
[ExternalConnect]
AcceptExternalConnections=1
ECUseTCPPort=1
ECPort=4712
ECPassword=
DlgTabsOnTop=0
UseSecIdent=1
IpFilterOn=1
UseSrcSeeds=1
ShowProgressBar=1
ShowPercent=0
ExtractMetaDataTags=0
FullChunkAlloc=0
FullPartAlloc=0
# touch /etc/init.d/amuled.sh
# vi /etc/init.d/amuled.sh
incollarci questo:
#!/bin/sh
#
# Startup/Stop script for aMuled - aMule Daemon
#
#Here, the choosen user to run amuled
theUser=
case "$1" in
'start')
/bin/su - ${theUser} -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amuled -f"
;;
'stop')
/bin/su - ${theUser} -c "PATH=/usr/local/bin:/usr/bin:/bin /usr/bin/amulecmd -c Shutdown"
;;
*)
echo "Usage: /etc/init.d/amuled.sh { start | stop }"
;;
esac
# cd /etc/init.d
# update-rc.d amuled.sh defaults (in questo modo amuled verrà lanciato automaticamente ad ogni avvio del sistema e verrà terminato in caso di riavvio o spegnimento)
Per rimuovere lo script dall'avvio automatico:
# update-rc.d -f amuled.sh remove
Per utilizzare aMule "normalmente" con la GUI:
$ amulegui
Va bene per qualsiasi versione di Amule?
LimiT-MaTz
25-07-2005, 18:25
già che ci sono vado un po off topic.
Qualcuno usa emule con fastweb? se si come ha risolto il problema che non ci sono piu' server e tutto gira sulla rete KADU.
A quando uno svilluppo della rete kad per a-mule ?
Ciao e scusate l'ot :D
già che ci sono vado un po off topic.
Qualcuno usa emule con fastweb? se si come ha risolto il problema che non ci sono piu' server e tutto gira sulla rete KADU.
A quando uno svilluppo della rete kad per a-mule ?
Ciao e scusate l'ot :D
per i fastwebbiani c'è l'emule adunanza
per l'implementazione kad a breve nella versione 2.10 mi sembra.. cmq guarda su amule.org
già che ci sono vado un po off topic.
Qualcuno usa emule con fastweb? se si come ha risolto il problema che non ci sono piu' server e tutto gira sulla rete KADU.
A quando uno svilluppo della rete kad per a-mule ?
Ciao e scusate l'ot :D
vai qui http://amuleadu.altervista.org/ così vedi come procede la cosa! :D
LimiT-MaTz
25-07-2005, 19:33
per i fastwebbiani c'è l'emule adunanza
per l'implementazione kad a breve nella versione 2.10 mi sembra.. cmq guarda su amule.org
Il supporto per kad da quanto ho letto sembra che tra poco (non troppo poco) verrò rilasciato
LimiT-MaTz
30-07-2005, 11:31
se vi interessa vi informo che e' uscito nei CVS.
Il supporto a KAD io lo sto usando e sembra abb stabile- ricordatevi di abilitare il supporto quando date ./configure
ho letto sia qua che sul forum di amule.org (l'autore dei post è lo stesso, o almeno credo)
cmq:
1) amulegui non c'è +
2) quando do amuled questo è l'output
bako@PC-FISSO-DEBIAN:~$ amuled
amuled: OnInit - starting timer
Initialising aMule
Checking if there is an instance already running...
Host: amule.sourceforge.net:80
URL: http://amule.sourceforge.net/lastversion
Response: 200 (Error: 0)
Download size: 6
HTTP download thread end
Loading temp files from /mnt/d/emule/Temp.
Loading PartFile 5 of 5
All PartFiles Loaded.
ListenSocket: Ok.
External connections disabled due to empty password!
*** Server UDP socket (TCP+3) at 0.0.0.0:4665
*** TCP socket (TCP) listening on 0.0.0.0:4662
*** Client UDP socket (extended eMule) at 0.0.0.0:4672
Adding file /mnt/d/emule/Temp/001.part.met to shares
Adding file /mnt/d/emule/Temp/002.part.met to shares
Adding file /mnt/d/emule/Temp/006.part.met to shares
Adding file /mnt/d/emule/Temp/007.part.met to shares
Adding file /mnt/d/emule/Temp/009.part.met to shares
HTTP download thread end
Servers: Trying to connect
General: CamuleDaemonApp::OnRun()
ERROR: aMule daemon cannot be used when external connections are disabled. To enable External Connections, use either a normal aMule or set the key"AcceptExternalConnections" to 1 in the file ~/.aMule/amule.conf
Now, exiting main app...
aMule shutdown: Terminating core.
Saving PartFile 5 of 5
All PartFiles Saved.
aMule shutdown completed.
se imposto AcceptExternalConnections=1 la volta dopo che lancio amuled da lo stesso output..
sistemato solo che ora ho 2 problemi:
1) non c'è più amulegui e anche con apt non esiste
2) lo scrpit fa partire amuled come root (e con tutte le sue impostazioni), mentre a me sereve che lo faccia partire come il mio user
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.