Re: [web2py] restart web2py command line

2010-04-29 Thread Jonathan Lundell
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 ""
(python $W2PDIR/web2py.py -p $PORT -N -a "") &
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



Re: [web2py] restart web2py command line

2010-04-29 Thread Thadeus Burgess
How are you running web2py?

If I need to kill a web2py process that I started from the command
line, but lost its process id I do the following command

$: ps aux | grep web2py
tburgess 12854  0.0  0.5 394812 62296 ?Sl   11:24   0:04
/usr/bin/python2.6 -u /home/tburgess/Applications/web2py/web2py.py -a
asdf
$: kill 12854

Sometimes web2py will hang and will not shut down, so you might have
to pass the -9 flag if it is still running after a minute or two.

$: kill -9 12854


--
Thadeus





On Thu, Apr 29, 2010 at 12:30 PM, Avik Basu  wrote:
> Hi,
> Is there a way to restart web2py from the command line in a linux
> environment?
> Avik
>


[web2py] restart web2py command line

2010-04-29 Thread Avik Basu
Hi,
Is there a way to restart web2py from the command line in a linux
environment?
Avik