]>
Commit | Line | Data |
---|---|---|
440d6759 | 1 | #!/bin/sh |
444fda89 ER |
2 | self=$0 |
3 | if [ -L "$self" ]; then | |
4 | self=$(readlink -f "$0") | |
5 | fi | |
6 | sock=$(dirname "$self")/request_handler_server.sock | |
440d6759 ER |
7 | daemon=0 |
8 | attach=0 | |
9 | ||
10 | if [ x"$1" = x"--daemon" -o x"$1" = x"-d" ]; then | |
11 | daemon=1 | |
12 | fi | |
13 | if [ x"$1" = x"--attach" -o x"$1" = x"-a" ]; then | |
14 | attach=1 | |
15 | fi | |
16 | ||
17 | if [ ! -S $sock ]; then | |
18 | daemon=1 | |
19 | fi | |
20 | ||
bcd2ee23 ER |
21 | # if none of the modes attach to it |
22 | if [ $daemon = 0 -a $attach = 0 ]; then | |
23 | attach=1 | |
444fda89 ER |
24 | fi |
25 | ||
440d6759 | 26 | if [ "$daemon" = 1 ]; then |
440d6759 ER |
27 | echo "Starting request_handler_server" |
28 | rm -f $sock | |
444fda89 | 29 | cd $(dirname $sock) |
440d6759 ER |
30 | exec dtach -n $(basename $sock) -r none python request_handler_server.py |
31 | exit 1 | |
32 | fi | |
bcd2ee23 ER |
33 | |
34 | # attach to session | |
35 | if [ "$attach" = 1 ]; then | |
36 | echo "Attaching to request_handler_server" | |
37 | exec dtach -a $sock | |
38 | exit 1 | |
39 | fi |