aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: launching amule with specific user  (Read 2275 times)

baron-robert

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 18
launching amule with specific user
« on: February 03, 2006, 11:02:33 PM »

Hi,
I want to start amuled on the startup of my fedora4 box with the command "amuled -f".
But i think that it will use the root user instead the 'emule` user  i create for launching it (a specific amule.conf file) for owning the process.
I dont know how tu setup this config. Does i have to use inetd, or the /etc/rc.d/rc.local file.
Is there an option to force amule to use a config file (like amuleweb -f /my/configfile.conf)

Thanks for your advices/response...
Baron-Robert
Logged

wardevil

  • Sr. Member
  • ****
  • Karma: -1
  • Offline Offline
  • Posts: 402
Re: launching amule with specific user
« Reply #1 on: February 03, 2006, 11:41:43 PM »

This is my script for that:
/etc/rc.d/init.d/amuled
Code: [Select]
#!/bin/sh
#
# Startup script for aMuled
#
# chkconfig: 345 80 30
#
# description: Starts the aMule deamon. The service is available \
#              via [URL]http://localhost:4711.[/URL] The deamon runs under \
#              the amule account
#
# processname: amule
USER=amule
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 -f &
         #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 "Killing webserver!!" && killall amuleweb
          return $RETVAL

 }

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  *)
        echo $"Usage: $0 {start|stop}"
        exit 1
esac

exit $?

Then in my system wich is a mandriva(almost a fedora directory structure i guess...) i just do to start when system boots:
chkconfig --level 345 amuled on

It works like a charm!!!  :))
Just chnage the user in the script to the user you will need to run amuled and thats it....

Cheers....
Logged
Linux user nÂș289016 at Linux counter