-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautowx2.sh
81 lines (68 loc) · 2.27 KB
/
autowx2.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
set -euo pipefail
export PYTHONIOENCODING=utf-8
if [[ ! -f /config/autowx2_conf.py ]] ; then
cp /autowx2/autowx2_conf.py /config/autowx2_conf.py
fi
rm -f /autowx2/autowx2_conf.py
ln -s /config/autowx2_conf.py /autowx2/autowx2_conf.py
if [[ ! -f /config/satellites.conf ]] ; then
cp /autowx2/satellites.conf /config/satellites.conf
fi
rm -f /autowx2/satellites.conf
ln -s /config/satellites.conf /autowx2/satellites.conf
if [[ ! -f /config/noaa.conf ]] ; then
cp -f /autowx2/modules/noaa/noaa.conf.example /config/noaa.conf
fi
rm -f /autowx2/modules/noaa/noaa.conf
ln -s /config/noaa.conf /autowx2/modules/noaa/noaa.conf
if [[ ! -f /config/meteor.conf ]] ; then
cp -f /autowx2/modules/meteor-m2/meteor.conf.example /config/meteor.conf
fi
rm -f /autowx2/modules/meteor-m2/meteor.conf
ln -s /config/meteor.conf /autowx2/modules/meteor-m2/meteor.conf
aaa=$(cat /autowx2/autowx2_conf.py | grep "aprs_freq" | grep -Eo '[0-9]{9}')
if [ "$aaa" != "" ]; then
sed -i "s/144800000/$aaa/g" /autowx2/bin/aprs.sh
echo Patch aprs.sh successful.
fi
aaa=$(cat /autowx2/autowx2_conf.py | grep "webInterfacePort" | grep -Eo '[0-9]{1,5}')
if [ "$aaa" == "" ]; then
aaa="5010"
echo "webInterfacePort = $aaa" >> /config/autowx2_conf.py
fi
sed -i "s/%WebInterface%/$aaa/g" /etc/nginx/sites-enabled/default
echo Patch nginx webinterfaceport successful.
aaa=$(cat /autowx2/autowx2_conf.py | grep "NginxListenPort" | grep -Eo '[0-9]{1,5}')
if [ "$aaa" == "" ]; then
aaa="5050"
echo "NginxListenPort = $aaa" >> /config/autowx2_conf.py
fi
sed -i "s/%NginxPort%/$aaa/g" /etc/nginx/sites-enabled/default
echo Patch nginx port successful.
mkdir -p /autowx2/var/www/recordings/noaa/img
mkdir -p /autowx2/var/www/recordings/iss/rec
mkdir -p /autowx2/var/www/recordings/meteor/raw
mkdir -p /autowx2/var/www/recordings/dump1090
#touch /autowx2/var/www/recordings/index.html
chmod 755 -R /autowx2/var/www/recordings/iss/rec
#. /autowx2/bin/update-keps.sh
/etc/init.d/nginx stop
/etc/init.d/nginx start
/etc/init.d/cron stop
/etc/init.d/cron start
cd /autowx2/bin
./gen-static-page.sh
if [ "$1" != "test" ]; then
_term() {
echo "Caught signal!"
kill -TERM "$child" 2>/dev/null
}
trap _term SIGTERM SIGINT
cd /autowx2
python ./autowx2.py &
child=$!
wait "$child"
else
echo You are now in test mode.
fi