aMule Forum

English => aMule Help => Topic started by: antcasq on June 18, 2005, 11:46:55 PM

Title: Boot with "amuled"
Post by: antcasq on June 18, 2005, 11:46:55 PM
Hello!

I'm using Suse 9.2 starting up with an user and amule in KDE startup, so that when I turned on the PC amule started.
Unfortunately my X Server crashes a lot, and when it does, amule process dies, although amuleweb doesn't (how is it possible!?!?)

So I would like to use "amuled" instead of "amule" because it doesn't requires a X environment.
Is there a way to start "amuled" when Suse boots?
I would like amuled to start with Suse and the process run as an user instead of root.

If there is a way please help me (I'm getting desperate)...

I'm using amule 2.0.3.


Thanks
Title: Re: Boot with "amuled"
Post by: stefanero on June 19, 2005, 10:36:41 AM
search the forum for init srcipts or auto start scripts....
there are at least 5-6 threads already
Title: Re: Boot with "amuled"
Post by: Theetjuh on June 19, 2005, 11:11:26 AM
Try a good distro with a stable wm ;)
Title: Script not working in SUSE
Post by: antcasq on June 19, 2005, 05:43:28 PM
I tryed the script

---------------
#!/bin/sh
#
# Startup script for aMuled
#
# chkconfig: 345 80 30
#
# description: Starts the aMule deamon. The service is available \
#              via http://localhost:4711. The deamon runs under \
#              the amule account
#
# processname: amule
USER=antcasq
RETVAL=0

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Avoid using root's TMPDIR
unset TMPDIR

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/bin/amuled -o -f /usr/local/bin/amuled  ] || exit 0


start() {
         printf "Starting the aMule daemon: "
         daemon  --user $USER amuled &
         #RETVAL is never returned by aMule?
         RETVAL=0
         echo
         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/amuled || \
          RETVAL=1
         return $RETVAL
}
stop() {
         printf "Shutting down the aMule daemon: "
         killproc amuled
         RETVAL=$?
         [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/amuled
         echo
         return $RETVAL
         
}
status() {
         status amuled
         RETVAL=$?
}
restart() {
         $0 stop
         $0 start
}
rhstatus() {
        status amuled
}


# Allow status as non-root.
if [ "$1" = status ]; then
       rhstatus
       exit $?
fi

case "$1" in
  start)
     start
   ;;
  stop)
     stop
   ;;
  restart)
     restart
   ;;
  reload)
     reload
   ;;
  status)
     rhstatus
   ;;
  condrestart)
     [ -f /var/lock/subsys/smb ] && restart || :
   ;;
  *)
   echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
   exit 1
esac

exit $?
---------------


But it doesn't work on SUSE or I need to install something...


I changed the script, commenting

[1]
## Source function library.
#if [ -f /etc/init.d/functions ] ; then
#  . /etc/init.d/functions
#elif [ -f /etc/rc.d/init.d/functions ] ; then
#  . /etc/rc.d/init.d/functions
#else
#  exit 0
#fi

because it always fails


[2]
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0

#[ -f /usr/bin/amuled -o -f /usr/local/bin/amuled  ] || exit 0

I get an error



[3]
         daemon  --user $USER amuled &
changed it to
         startproc -u $USER -l /var/log/amuled_antcasq.log /usr/bin/amuled -o -f
because it seans deamon command doesn't exist!?!
however it still doesn't start, I get the following error in the log:
--------------
16:48:54: Error: Directory '//.aMule/' couldn't be created (error 13: Permission denied)
16:48:54: Error: can't open file '//.aMule//logfile' (error 2: No such file or directory)
ERROR: unable to open log file
amuled: OnInit - starting timer
Daemon will fork to background - log to stdout disabled
Initialising aMule
Checking if there is an instance already running...
--------------
I think it's trying to use roots account although I told the process to start as another user.


Is there a way to fix it?
What's wrong?
Title: RE: Script not working in SUSE
Post by: GonoszTopi on June 19, 2005, 07:22:17 PM
I would put the following line into /etc/rc.d/rc.local (or something that SUSE runs at startup):

su -c /usr/bin/amuled >/dev/null &

It is not as elegant as the start/stop scripts, but should do the job.
Note that you'll get no output from amuled except in its logfile....
Title: RE: Script not working in SUSE
Post by: antcasq on June 19, 2005, 10:16:24 PM
Thanks, it works.

I replaced
 startproc -u $USER -l /var/log/amuled_antcasq.log /usr/bin/amuled -o -f
with
su -c /usr/bin/amuled >/dev/null &


When the process is killed it becomes "defunct", because it was started via "su"
As long as it works, its fine by me :]

Thank you very much!