init.d script for folding at home client
hey guys,
I decided to donate my spare cpu cycles with the folding at home linux client.
So, I wanted to try and to this the "proper way", ie, with a init.d script. I
started from /etc/init.d/skeleton and came up with this (see below).
I put the client in /usr/local/folding, and made the entire dir chown nobody,
then update-rc.d folding.sh defaults.
It works fine, but can anyone give me some criticism on this, specifically
security aspects? This is my first time to do this kind of thing.
here is /etc/init.d/folding.sh: (the line wraps are a little fubared)
--- cut here ---
#! /bin/sh
# folding at home init.d script for debian, based off of /etc/init.d/skeleton.
# by jason pepas.
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/folding
DAEMON=/usr/local/folding/FAH3Console-Linux.exe
NAME=FAH3Console-Linux.exe
DESC="Folding at Home client"
USER=nobody
test -x $DAEMON || exit 0
set -e
up ()
{
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --chuid $USER --quiet --background --nicelevel 19
--make-pidfile --pidfile /usr/local/folding/$NAME.pid \
--exec $DAEMON
echo "."
}
down ()
{
echo -n "Stopping $DESC: $NAME"
start-stop-daemon --stop --chuid $USER --quiet --pidfile
/usr/local/folding/$NAME.pid \
--exec $DAEMON
echo "."
rm -f /usr/local/folding/$NAME.pid
}
case "$1" in
start)
up
;;
stop)
down
;;
reload)
down
sleep 1
up
;;
restart|force-reload)
down
sleep 1
up
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
--- cut here ---
-jason pepas
Reply to: