On Apr 29, 2010, at 10:30 AM, Avik Basu wrote:
> Is there a way to restart web2py from the command line in a linux
> environment?
I adapted one of the startup scripts in scripts/ (I think I started with the
Fedora one) to make a shell script that I use from the command line. It'd be
easy enough to add a 'restart' case that combines stop & start.
#!/bin/sh
#
# start web2py with recycled password and no tk UI
# -N disables cron
#
W2PDIR=path-to-web2py
PIDFILE=httpserver.pid
SCRIPT=`basename $0`
PORT=8000
PW=admin-password
if [ "$1" == first ]; then
echo $W2PDIR/web2py -p $PORT -a $PW
(python $W2PDIR/web2py.py -p $PORT -N -a $PW) &
echo
echo vpepm started
elif [ "$1" == start ]; then
echo $W2PDIR/web2py -p $PORT -a "<recycle>"
(python $W2PDIR/web2py.py -p $PORT -N -a "<recycle>") &
echo
echo vpepm started
elif [ "$1" == stop ]; then
if [ ! -r $W2PDIR/$PIDFILE ]; then
echo pid file $PIDFILE not found
exit 1
fi
PID=`cat $W2PDIR/$PIDFILE`
rm -f $W2PDIR/$PIDFILE
kill -TERM $PID
echo vpepm stopped
else
echo "usage: $SCRIPT start|stop"
exit 1
fi
exit 0