~mbp/+junk/web2py-test

« back to all changes in this revision

Viewing changes to scripts/web2py.archlinux.sh

  • Committer: Martin Pool
  • Date: 2009-12-07 01:05:02 UTC
  • Revision ID: mbp@sourcefrog.net-20091207010502-2yyruvkqcnhu5zx8
snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# the script should be run
 
3
# from WEB2PY root directory
 
4
 
 
5
prog=`basename $0`
 
6
 
 
7
cd `pwd`
 
8
chmod +x $prog
 
9
 
 
10
function web2py_start {
 
11
  nohup ./$prog -a "<recycle>" 2>/dev/null &
 
12
  pid=`pgrep $prog | tail -1`
 
13
  if [ $pid -ne $$ ]
 
14
  then
 
15
    echo "WEB2PY has been started."
 
16
  fi 
 
17
}
 
18
function web2py_stop {
 
19
  kill -15 `pgrep $prog | grep -v $$` 2>/dev/null
 
20
  pid=`pgrep $prog | head -1`
 
21
  if [ $pid -ne $$ ]
 
22
  then
 
23
    echo "WEB2PY has been stopped."
 
24
  fi
 
25
}
 
26
 
 
27
case "$1" in
 
28
  start)
 
29
    web2py_start
 
30
  ;;
 
31
  stop)
 
32
    web2py_stop
 
33
  ;;
 
34
  restart)
 
35
    web2py_stop
 
36
    web2py_start
 
37
  ;;
 
38
  *)
 
39
    echo "Usage: $prog [start|stop|restart]"
 
40
  ;;
 
41
esac
 
42
 
 
43
exit 0