-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_cron.sh
48 lines (41 loc) · 1020 Bytes
/
check_cron.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
#!/bin/bash
set -euo pipefail
if [[ ! -f /config/settings.php ]] ; then
cp /var/www/FlightAirMap/require/settings.php /config
fi
rm -f /var/www/FlightAirMap/require/settings.php
ln -s /config/settings.php /var/www/FlightAirMap/require/settings.php
_term() {
echo "Caught signal!"
kill -TERM "$child" 2>/dev/null
}
trap _term SIGTERM SIGINT
#python3 openwebrx.py $@ &
AA="FALSE"
while true
do
AA=$(cat /var/www/FlightAirMap/require/settings.php | grep globalInstalled | awk '{if($1){print $3}}' | cut -d ";" -f 1 | tr 'a-z' 'A-Z')
if [ "$AA" == "TRUE" ]; then
break
fi
echo Install status: $AA
sleep 60
done
BB=1
while true
do
CC=$(ps | grep cron-sbs | wc -l)
if [ $CC -lt 2 ]; then
echo restart cron-sbs
/bin/sh -c "/usr/bin/php /var/www/FlightAirMap/scripts/cron-sbs.php" &
fi
BB=$(($BB+1))
if [ $BB -gt 1440 ]; then
echo startup update_db
/bin/sh -c "/usr/bin/php /var/www/FlightAirMap/scripts/update_db.php" &
BB=1
fi
sleep 60
done
child=$$
wait "$child"