-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·55 lines (49 loc) · 1.51 KB
/
run.sh
File metadata and controls
executable file
·55 lines (49 loc) · 1.51 KB
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
#!/bin/bash
##
# Nicolas THIBAUT
# nicolas.thibaut@l-3s.com
##
pushd `dirname "$0"` > /dev/null 2>&1
source venv/bin/activate
shopt -s expand_aliases
export PYTHONDONTWRITEBYTECODE="1"
export LC_ALL="C.UTF-8"
export LANG="C.UTF-8"
if [ -z "$1" ]; then
RESULT=`supervisorctl pid osfw-sensor 2> /dev/null`
if [ "$RESULT" == 0 ] || [ -z "$RESULT" ]; then
RESULT=`find /var/run/screen -name "*.osfw-sensor" | wc -l | xargs`
if [ "$RESULT" == 0 ]; then
screen -dmS osfw-sensor python osfw.py daemon/sensor
else
echo "Error: osfw-sensor is already running in a screen"
fi
else
echo "Error: osfw-sensor is already running from supervisor"
fi
RESULT=`supervisorctl pid osfw-syncfw 2> /dev/null`
if [ "$RESULT" == 0 ] || [ -z "$RESULT" ]; then
RESULT=`find /var/run/screen -name "*.osfw-syncfw" | wc -l | xargs`
if [ "$RESULT" == 0 ]; then
screen -dmS osfw-syncfw python osfw.py daemon/syncfw
else
echo "Error: osfw-syncfw is already running in a screen"
fi
else
echo "Error: osfw-syncfw is already running from supervisor"
fi
RESULT=`supervisorctl pid osfw-webapp 2> /dev/null`
if [ "$RESULT" == 0 ] || [ -z "$RESULT" ]; then
RESULT=`find /var/run/screen -name "*.osfw-webapp" | wc -l | xargs`
if [ "$RESULT" == 0 ]; then
screen -dmS osfw-webapp python osfw.py webapp
else
echo "Error: osfw-webapp is already running in a screen"
fi
else
echo "Error: osfw-webapp is already running from supervisor"
fi
else
python osfw.py "$1"
fi
popd > /dev/null 2>&1