]>
Commit | Line | Data |
---|---|---|
7a5b97a0 MT |
1 | #!/bin/bash |
2 | ||
3 | HOMEDIR=$(dirname $(readlink $0)) | |
853ae0e4 | 4 | LOGFILE=/var/log/webapp/error.log |
7a5b97a0 MT |
5 | |
6 | case "$1" in | |
7 | start) | |
858d8259 JPT |
8 | if ps ax | grep -v grep | grep webapp.py > /dev/null |
9 | then | |
10 | echo "webapp is allready running..." | |
11 | else | |
12 | echo "Starting webapp..." | |
13 | cd ${HOMEDIR} && ./webapp.py >>${LOGFILE} 2>&1 & | |
14 | fi | |
7a5b97a0 MT |
15 | ;; |
16 | ||
17 | stop) | |
858d8259 JPT |
18 | if ps ax | grep -v grep | grep webapp.py > /dev/null |
19 | then | |
20 | echo "Stopping webapp..." | |
21 | killall webapp.py &> /dev/null | |
22 | else | |
23 | echo "webapp is not running..." | |
24 | fi | |
7a5b97a0 MT |
25 | ;; |
26 | ||
27 | restart) | |
28 | $0 stop | |
29 | sleep 2 | |
30 | $0 start | |
31 | ;; | |
32 | ||
33 | check) | |
858d8259 JPT |
34 | if ps ax | grep -v grep | grep webapp.py > /dev/null |
35 | then | |
be49f640 JPT |
36 | : |
37 | # echo "webapp is running..." | |
7a5b97a0 | 38 | else |
858d8259 JPT |
39 | echo "webapp is not running!" |
40 | $0 start | |
be49f640 | 41 | fi |
858d8259 JPT |
42 | ;; |
43 | ||
44 | *) | |
45 | echo "usage: webapp [ start | stop | restart | check ]" | |
7a5b97a0 | 46 | ;; |
858d8259 | 47 | |
7a5b97a0 | 48 | esac |