Hello Matt,

I allowed myself some changes, mostly related to portability (the
script is supposed to be "/usr/bin/web2py.py" or somewhere else in
$PATH):


#!/bin/bash

prog=`basename $0`

cd `pwd`
chmod +x $prog

function web2py_start {
  nohup ./$prog -a "<recycle>" 2>/dev/null &
  if [ ! -z "`pgrep $prog`" ]
  then
    echo "WEB2PY has been started."
  fi
}
function web2py_stop {
  pid=`pgrep $prog | head -1`
  kill -15 `pgrep $prog | grep -v $$` 2>/dev/null
  if [ $pid -ne $$ ]
  then
    echo "WEB2PY has been stopped."
  fi
}

case "$1" in
  start)
    web2py_start
  ;;
  stop)
    web2py_stop
  ;;
  restart)
    web2py_stop
    web2py_start
  ;;
  *)
    echo "Usage: $prog [start|stop|restart]"
  ;;
esac

exit 0


Have a nice time with web2py!


On Mar 25, 10:53 pm, "mgbeli...@gmail.com" <mgbeli...@gmail.com>
wrote:
> Hello all,
>
> I'm a web developer just getting my feet wet with web2py.  I just
> wrote my own daemon for web2py for the archlinux distribution which I
> am using, so  I though I'd share it in hopes that you'd bundle it with
> the whole package.  It's not tested on any other distro besides
> archlinux, but my guess is it might work on slackware too.
>
> Thanks,
>
> Matt Belisle
>
> begin text:
> #!/bin/bash
> # This is the web2py daemon (web2pyd) for archlinux.  It is
> recommended that you save the web2py
> # folder as /usr/lib/web2py, but if it's somewhere else just modify
> the variable below.
> # Author: Matt Belisle mgbeli...@gmail.com
>
> # Default folder
> # WEB2PY_FOLDER="/your/custom/folder"
> WEB2PY_FOLDER="/usr/lib/web2py"
>
> . /etc/rc.conf
> . /etc/rc.d/functions
> case "$1" in
>   start)
>     stat_busy "Starting web2py Daemon"
>     pkill -f web2py.py &> /dev/null
>     python ${WEB2PY_FOLDER}/web2py.py -a "<recycle>" -P -p 8000 &> /
> dev/null &
>     add_daemon web2pyd
>     stat_done
>     ;;
>   stop)
>     stat_busy "Stopping web2py Daemon"
>     pkill -f web2py.py &> /dev/null
>     rm_daemon web2pyd
>     stat_done
>     ;;
>   restart)
>     $0 stop
>     sleep 1
>     $0 start
>     ;;
>   *)
>     echo "usage: $0 {start|stop|restart}"
> esac
> exit 0
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to