-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeloldstations.sh
executable file
·18 lines (16 loc) · 1.48 KB
/
deloldstations.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash
echo "Delete data where we have not data on the station location"
ps=$(mysql -e 'select count(*) from stationlocation where lt is NULL ' ognrange)
nc=$(echo $ps | sed 's/^count(\*) //g')
if [ $nc != '0' ]
then
mysql -e 'DELETE FROM positions_mgrs WHERE station in (select distinct station from stationlocation where lt is NULL) ' ognrange
fi
mysql -e 'DELETE FROM availability WHERE station_id in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE FROM availability_log WHERE station_id in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE FROM roughcoverage WHERE station in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE FROM estimatedcoverage WHERE station in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE FROM stats WHERE station in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE FROM statssummary WHERE station in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE FROM stations WHERE id in (select distinct station from stationlocation where lt is NULL) ' ognrange
mysql -e 'DELETE from stationlocation where lt is NULL ' ognrange