-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.sh
71 lines (57 loc) · 1.74 KB
/
service.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
ROOT_PATH=/users/hpcusers
ARGOBALSAM_PATH=$ROOT_PATH/argobalsam/dev
GRIDCERT_PATH=$ROOT_PATH/argobalsam/gridsecurity
#source $ROOT_PATH/scripts/setupPython-2.7.sh
#export X509_USER_CERT=/tmp/x509up_u30168
#export X509_USER_KEY=/tmp/x509up_u30168
export X509_USER_CERT=$GRIDCERT_PATH/$USER/xrootdsrv-cert.pem
export X509_USER_KEY=$GRIDCERT_PATH/$USER/xrootdsrv-key.pem
#export X509_CERT_DIR=$GRIDCERT_PATH/certificates
export X509_CACERTS=$GRIDCERT_PATH/$USER/cacerts.pem
export X509_CERT_DIR=/etc/grid-security/certificates
#export X509_USER_CERT=/users/hpcusers/argobalsam/production/argobalsam/keycert.txt
#export X509_USER_KEY=/users/hpcusers/argobalsam/production/argobalsam/keycert.txt
PID_FILE=pids.txt
start() {
# kill old processes first
while read pid; do
kill -0 $pid > /dev/null 2>&1
if [[ $? == '0' ]]; then
echo killing old instance before starting: PID = $pid, cmd:
echo $(cat /proc/$pid/cmdline | strings -1)
kill -- -$pid
fi
done <$PID_FILE
python manage.py argo_service > ./log/argo_service.out 2>&1 &
echo $! > $PID_FILE
python manage.py balsam_service > ./log/balsam_service.out 2>&1 &
echo $! >> $PID_FILE
python manage.py runserver 8001 > ./log/runserver.log 2>&1 &
echo $! >> $PID_FILE
}
stop() {
while read pid; do
kill -0 $pid > /dev/null 2>&1
if [[ $? == '0' ]]; then
echo killing instance: PID = $pid, cmd:
echo $(cat /proc/$pid/cmdline | strings -1)
kill -- -$pid
fi
done <$PID_FILE
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart|force-reload)
stop
start
;;
**)
echo "Usage: $0 {start|stop|reload}" 1>&2
;;
esac