Yep, I'm on a gentoo system, with 2.6.17, gcc 4.1, and amule 2.1.3.
I've started again with the script from scratch because the old one i killed from editing too much. The things i've changed from the original script above is
USER=root (for now till i fix it)
DISPLAY="localhost:0"
what i need to change now is line 31, because that to me looks more redhat/mandrake than gentoo. I'm trying to replace that line with the following,
start-stop-daemon --start --make-pidfile --pidfile /var/run/amule.pid -c root -x /usr/bin/amule
That's the closest i managed to figure out after reading a few other scripts in there. Now, this allows for my script to run, up to that point, where it still insists that there's no display set properly.
localhost ~ # /etc/init.d/amule start
Starting aMule : Error: Unable to initialize gtk, is DISPLAY set properly?
Here's the whole file.
#!/bin/sh
#
# Startup script for aMule
#
# chkconfig: 345 80 30
#
# description: Starts aMule with webserver,the service is available \
# via [URL]http://localhost:4711.[/URL] The GUI runs under \
# the user account
#
# processname: amule
USER=root
RETVAL=0
# Source function library.
if [ -f /etc/init.d/functions.sh ] ; then
. /etc/init.d/functions.sh
else
exit 0
fi
# Avoid using root's TMPDIR
#unset TMPDIR
[ -f /usr/bin/amule -o -f /usr/local/bin/amule ] || exit 0
export DISPLAY="localhost:0"
start() {
printf "Starting aMule : "
#daemon --user $USER amule &
start-stop-daemon --start --make-pidfile --pidfile /var/run/amule.pid -c root -x /usr/bin/amule
#RETVAL is never returned by aMule?
RETVAL=0
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/amule || \
RETVAL=1
return $RETVAL
}
stop() {
printf "Shutting down the aMule daemon: "
killproc amule
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/amule
echo "Killing webserver!!" && killall amuleweb
return $RETVAL
}
restart() {
$0 stop
$0 start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
[ -f /var/lock/subsys/amule ] && restart || :
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
exit 1
esac
exit $?
Now, after reading the error again, i did an echo $DISPLAY, and i got the result: 0.0. So i tried changing the script's display to localhost:0.0 but still the same error. I did another echo $DISPLAY afterwards to see if anything changed, but it was still the same. So i manually changed it with export $DISPLAY="localhost:0" (putting it like that in the script again too), but still the same error. So i'm confused and i think something's wrong with this display setting as a whole..
Thanks for the help so far.
edit1: if it helps, here's the output of ps -ef for X
root 9267 9264 0 Jul21 tty7 00:13:26 /usr/bin/X :0 -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp vt7