scripts/web2py.fedora.sh has a couple of problems, which I've fixed. I've
cleaned it up in the meantime.
The new version is below. I can supply it in another form if you like.
The main problem was that it was sending SIGQUIT for stop, when web2py expects
SIGTERM. That didn't work out (not to mention that SIGQUIT generates a core
file.
I parameterized the python executable (I need to force python2.6 in my
environment), added -Q and --nogui, and removed -P.
I also removed a couple of shell functions that weren't being used. The result
is working OK in my RHEL5 environment.
#!/bin/bash
#
# /etc/rc.d/init.d/web2pyd
#
# Starts the Web2py Daemon on Fedora (Red Had Linux)
#
# To execute automatically at startup
#
# sudo chkconfig --add web2pyd
#
# chkconfig: 2345 90 10
# description: Web2py Daemon
# processname: web2pyd
# pidfile: /var/lock/subsys/web2pyd
source /etc/rc.d/init.d/functions
RETVAL=0
NAME=web2pyd
DESC="Web2py Daemon"
DAEMON_DIR="/usr/lib/web2py"
ADMINPASS="admin"
#ADMINPASS="<recycle>"
PIDFILE=/var/run/$NAME.pid
PORT=8001
PYTHON=python
cd $DAEMON_DIR
start() {
echo -n $"Starting $DESC ($NAME): "
daemon --check $NAME $PYTHON $DAEMON_DIR/web2py.py -Q --nogui -a $ADMINPASS
-d $PIDFILE -p $PORT &
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/$NAME
fi
echo
return $RETVAL
}
stop() {
echo -n $"Shutting down $DESC ($NAME): "
if [ -r "$PIDFILE" ]; then
pid=`cat $PIDFILE`
kill -TERM $pid
RETVAL=$?
else
RETVAL=1
fi
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$NAME
rm -f $PIDFILE
fi
return $RETVAL
}
restart() {
stop
start
}
status() {
if [ -r "$PIDFILE" ]; then
pid=`cat $PIDFILE`
fi
if [ $pid ]; then
echo "$NAME (pid $pid) is running..."
else
echo "$NAME is stopped"
fi
}
case "$1" in
start) start;;
stop) stop;;
status) status;;
restart) restart;;
condrestart) [ -e /var/lock/subsys/$NAME ] && restart
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
RETVAL=1
;;
esac
exit $RETVAL
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.