-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoptim.sh
executable file
·146 lines (146 loc) · 4.23 KB
/
optim.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
day=`date "+%a"`
DMY=`date "+%x"`
now=`date "+%R"`
hn=`hostname `
taken=$day"_"$DMY"_"$now
echo "Start optimization of the OGNRANGE DB deleting old data"
echo "======================================================="
echo "Starting deleting zombie stations at: "$(date)
date
echo "Query number of active stations"
mysql <queryactivestations.sql
echo "Query number of empty stations"
mysql <queryemptystations.sql
#
if [ -f /tmp/OGNrangeoptim.pid ]
then
echo "Other OGNRANGE optim process runninng .... "$(cat /tmp/OGNrangeoptim.pid)" if not, delete the /tmp/OGNrangeoptim.pid file"
exit
fi
#
echo "Stop de OGNRANGE daemon, in order to improve performance"
#
killall perl >/dev/null 2>&1
#
echo $$ > /tmp/OGNrangeoptim.pid
if [ ! -f /tmp/OGNrangeoptim.pid ]
then
touch /tmp/OGNrangeoptim.pid
fi
#
echo "Count first the number of zombie stations"
#
bash countoldstations.sh
bash countzombies.sh
#
echo "Deleting the phantom STATIONS"
#
date
###################################
bash deletephantoms.sh NAVITER
bash deletephantoms.sh ADSB
bash deletephantoms.sh FLYMASTER
bash deletephantoms.sh SPOT
bash deletephantoms.sh notSPOT
bash deletephantoms.sh SPIDER
bash deletephantoms.sh INREACH
bash deletephantoms.sh Inreach
bash deletephantoms.sh SKYLINES
bash deletephantoms.sh SafeSky
bash deletephantoms.sh LT24
bash deletephantoms.sh CAPTURS
bash deletephantoms.sh RELAY
bash deletephantoms.sh "0"
bash deletephantoms.sh NONE
bash deletephantoms.sh Test
bash deletephantoms.sh N0CALL
bash deletephantoms.sh Home
bash deletephantoms.sh MyStation
bash deletephantoms.sh abcde
bash deletephantoms.sh NEMO
bash deletephantoms.sh Android
bash deletephantoms.sh TTN2OGN
bash deletephantoms.sh TTN3OGN
bash deletephantoms.sh Heliu2OGN
bash deletephantoms.sh OBS2OGN
bash deletephantoms.sh APRSPUSH
bash deletephantoms.sh DLY2APRS
bash deletephantoms.sh IGCDroid
bash deletephantoms.sh Microtrack
bash deletephantoms.sh GIGA01
bash deletephantoms.sh UNSET
bash deletephantoms.sh PWUNSET
bash deletephantoms.sh GLIDERNA
###################################
#
echo "Deleting the pseudo STATIONS"
#
date
bash deleteFNB.sh FNB Y
bash deleteFNB.sh XCG Y
bash deleteFNB.sh XCC Y
bash deleteFNB.sh OGN Y
bash deleteFNB.sh ICA Y
bash deleteFNB.sh FLR Y
bash deleteFNB.sh SKY Y
bash deleteFNB.sh bSkyN Y
bash deleteFNB.sh AIRS Y
bash deleteFNB.sh AIRS- Y
bash deleteFNB.sh TEST Y
bash deleteFNB.sh SKYS Y
bash deleteFNB.sh ADSB Y
#
#mysql ognrange <config/deleteoldata.sql
#
date
echo "Delete empty stations"
mysql <delemptystations.sql
mysql -e "delete from stations where otime = '1970-01-01';" ognrange
mysql -e "delete from stats where station = 0 ;" ognrange
date
echo "deleting the data before January 2022"
mysql -e "delete from stations where otime < '2022-01-01';" ognrange
mysql -e "delete from history where time < '2022-01-01';" ognrange
mysql -e "delete from stationlocation where time < '2022-01-01';" ognrange
mysql -e "delete from stats where time < '2022-01-01';" ognrange
mysql -e "delete from positions_mgrs where time < '2022-01-01';" ognrange
date
#
echo "Check and delete stations with no location and data with no station in the ognrange database"
#
date
/usr/bin/python delzombies.py
date
echo "Delete record with station that do not exist anymore on the database"
bash delzombies.sh
date
#
echo "Check the ognrange database"
#
date
mysql -e "reset query cache;" ognrange
mysqlcheck ognrange
mysql -e "reset query cache;" ognrange
date
echo "Optimize the ognrange database"
mysqlcheck --optimize --skip-write-binlog ognrange availability availability_log estimatedcoverage gliders history roughcoverage stationlocation stations stats statssummary
#
echo "Count now the number of zombie stations"
#
date
bash countoldstations.sh
date
bash countzombies.sh
date
echo "Query number of active stations"
mysql <queryactivestations.sql
echo "Query number of empty stations"
mysql <queryemptystations.sql
# remove the mark that this process is running
rm /tmp/OGNrangeoptim.pid >/dev/null 2>&1
#
echo "Start now the OGNRANGE daemon ..."
#
date
cd