[nmglug] Debian Startup Script
Tim Emerick
timothyemerick at yahoo.com
Mon Oct 4 11:33:57 PDT 2004
Hey all.
I've been attempting to convert a startup script from Redhat to work on my Debian machine but being a bit of a noob it's greek to me. Can someone help me out. It's a script to startup BOINC as a daemon as the user boinc.
The original Redhat script is here (http://noether.vassar.edu/~myers/help/boinc/init.d-boinc). I compared it to some standard debian scripts (atd, samba, etc) and I'm sure hacked it to pieces. The original script worked once I commented out the redhat functions line (line 20??). It was ugly and spewed error messages but it worked. Here's what I have so far in my conversion process......it doesn't work. ...sigh...
Thanks - Tim
#!/bin/sh
#
# Debian GNU/Linux start/stop script to run the BOINC client as a daemon
# at system startup, as the boinc user (not root).
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
BOINCUSER=boinc
BOINCDIR=/home/boinc
BUILD_ARCH=i686-pc-linux-gnu
LOGFILE=boinc.log
ERRORLOG=error.log
BOINCOPTS="-allow_remote_gui_rpc"
PIDFILE=/var/run/boinc.pid
## Locate the working directory
if [ ! -d $BOINCDIR ]; then
echo "Cannot find boinc directory $BOINCDIR "
exit 1
fi
## Locate the executable with highest version
BOINCEXE=`/bin/ls -1 $BOINCDIR/boinc_*_$BUILD_ARCH 2>/dev/null | tail -n 1 `
if [ ! -x "$BOINCEXE" ]; then
echo "Cannot find/run boinc executable $BOINCEXE "
exit 2
fi
test -x $BOINCEXE || exit 0
## Functions: start/stop/status/restart
case "$1" in
start)
cd $BOINCDIR
if [ ! -f client_state.xml ] ; then
echo -n "BOINC client requires initialization first."
echo -ne "\t[FAILED]\n"
echo
exit 3
fi
echo -n "Starting BOINC client as a daemon: "
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $BOINCEXE $BOINCOPTS >>$LOGFILE 2>>$ERRORLOG -- -u $BOINCUSER
echo
;;
stop)
echo -n "Stopping boinc client daemon"
start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $BOINCEXE
echo
;;
restart)
$0 stop
$0 start
;;
status)
PID=`pidof $BOINCEXE`
if [ "$PID" != "" ]; then
echo "BOINC client is running (pid $PID)."
else
echo "BOINC client is stopped."
fi
;;
*)
echo "Usage: boinc {start|stop|restart|status}"
exit 1
esac
exit
##
---------------------------------
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nmglug.org/pipermail/nmglug-nmglug.org/attachments/20041004/3ec54abc/attachment.htm>
More information about the nmglug
mailing list