Загрузил файл
This commit is contained in:
parent
780adf11cd
commit
3643f45385
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [config file] [collector number]"
|
||||
exit
|
||||
fi
|
||||
|
||||
CONFIGFILE=$1
|
||||
COLLECTORNUMBER=$2
|
||||
|
||||
if ps -ef | grep -v grep | grep "bin/collector.py $CONFIGFILE $COLLECTORNUMBER" ; then
|
||||
exit 0
|
||||
else
|
||||
CURRENTDIR=$(dirname $0)
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:$CURRENTDIR/../trackdirect:$CURRENTDIR/../../heatmap-2.2.1/
|
||||
cd $CURRENTDIR/..
|
||||
python2 ./bin/collector.py $CONFIGFILE $COLLECTORNUMBER
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [dbname] [dbport] [sqlpath]"
|
||||
exit
|
||||
fi
|
||||
|
||||
DATABASE=$1
|
||||
PORT=$2
|
||||
SQLPATH=$3
|
||||
|
||||
# Assumes .pgpass is correctly set
|
||||
psql -p $PORT $DATABASE << EOF
|
||||
|
||||
begin transaction;
|
||||
|
||||
\i $SQLPATH/01_map.sql
|
||||
\i $SQLPATH/02_marker.sql
|
||||
\i $SQLPATH/03_ogn_address_type.sql
|
||||
\i $SQLPATH/04_ogn_aircraft_type.sql
|
||||
\i $SQLPATH/05_ogn_device.sql
|
||||
\i $SQLPATH/06_ogn_hidden_station.sql
|
||||
\i $SQLPATH/07_packet_type.sql
|
||||
\i $SQLPATH/08_sender.sql
|
||||
\i $SQLPATH/09_source.sql
|
||||
\i $SQLPATH/10_station_type.sql
|
||||
\i $SQLPATH/11_station.sql
|
||||
\i $SQLPATH/12_station_telemetry_bits.sql
|
||||
\i $SQLPATH/13_station_telemetry_eqns.sql
|
||||
\i $SQLPATH/14_station_telemetry_param.sql
|
||||
\i $SQLPATH/15_station_telemetry_unit.sql
|
||||
\i $SQLPATH/16_packet.sql
|
||||
\i $SQLPATH/17_packet_weather.sql
|
||||
\i $SQLPATH/18_packet_telemetry.sql
|
||||
\i $SQLPATH/19_packet_path.sql
|
||||
\i $SQLPATH/20_packet_ogn.sql
|
||||
|
||||
commit;
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [config file] [destination directory]"
|
||||
exit
|
||||
fi
|
||||
|
||||
CONFIGFILE=$1
|
||||
|
||||
if ps -ef | grep -v grep | grep "bin/heatmapcreator.py $CONFIGFILE"; then
|
||||
exit 0
|
||||
else
|
||||
cd ..
|
||||
CURRENTDIR=$(dirname $0)
|
||||
DESTDIR=$2
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:$CURRENTDIR/../trackdirect:$CURRENTDIR/../../heatmap-2.2.1/
|
||||
cd $CURRENTDIR/..
|
||||
python2 $CURRENTDIR/../bin/heatmapcreator.py $CONFIGFILE $DESTDIR
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [dbname] [dbport]"
|
||||
exit
|
||||
fi
|
||||
|
||||
DATABASE=$1
|
||||
PORT=$2
|
||||
|
||||
pushd `dirname $0` > /dev/null
|
||||
SCRIPTPATH=`pwd -P`
|
||||
popd > /dev/null
|
||||
|
||||
# Create dir and remove old stuff (keep zip-file since it may be equal to latest)
|
||||
mkdir -p $SCRIPTPATH/ogndevices
|
||||
mkdir -p $SCRIPTPATH/ogndevices/${DATABASE}
|
||||
rm $SCRIPTPATH/ogndevices/${DATABASE}/*.csv
|
||||
rm $SCRIPTPATH/ogndevices/${DATABASE}/*.txt
|
||||
cd $SCRIPTPATH/ogndevices/${DATABASE}
|
||||
|
||||
# Download latest csv file (but only if newer)
|
||||
wget -N http://ddb.glidernet.org/download/?t=1 -O ogndevices.csv
|
||||
|
||||
if test `find "ogndevices.csv" -cmin +30`
|
||||
then
|
||||
echo "File is not updated, skip reload of database."
|
||||
else
|
||||
|
||||
|
||||
# Remove comments in file
|
||||
sed '/^#/ d' < ogndevices.csv > ogndevices2.csv
|
||||
|
||||
# Load file into database (assumes .pgpass is correctly set)
|
||||
psql -p $PORT $DATABASE << EOF
|
||||
|
||||
create table if not exists ogn_device (
|
||||
"device_type" text not null,
|
||||
"device_id" text not null,
|
||||
"aircraft_model" text not null,
|
||||
"registration" text not null,
|
||||
"cn" text not null,
|
||||
"tracked" text not null,
|
||||
"identified" text not null,
|
||||
"ddb_aircraft_type" text not null
|
||||
);
|
||||
|
||||
begin transaction;
|
||||
|
||||
drop index if exists ogn_device_device_id_idx;
|
||||
truncate ogn_device;
|
||||
copy ogn_device from '$SCRIPTPATH/ogndevices/$DATABASE/ogndevices2.csv' DELIMITERS ',' CSV QUOTE '''';
|
||||
create index ogn_device_device_id_idx on ogn_device(device_id);
|
||||
|
||||
insert into ogn_device(device_type, device_id, aircraft_model, registration, cn, tracked, identified, ddb_aircraft_type) values ('F', '3FEF6F', '', '', '', 'N', 'N', 1);
|
||||
commit;
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [config file path]"
|
||||
exit
|
||||
fi
|
||||
|
||||
CONFIGFILE=$1
|
||||
|
||||
if ps -ef | grep -v grep | grep "bin/remover.py $CONFIGFILE" ; then
|
||||
exit 0
|
||||
else
|
||||
CURRENTDIR=$(dirname $0)
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:$CURRENTDIR/../trackdirect:$CURRENTDIR/../../heatmap-2.2.1/
|
||||
cd $CURRENTDIR/..
|
||||
python2 $CURRENTDIR/../bin/remover.py $CONFIGFILE
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [config file path] [station id]"
|
||||
exit
|
||||
fi
|
||||
|
||||
CONFIGFILE=$1
|
||||
STATIONID=$2
|
||||
|
||||
if ps -ef | grep -v grep | grep "bin/stationremover.py $CONFIGFILE $STATIONID" ; then
|
||||
exit 0
|
||||
else
|
||||
CURRENTDIR=$(dirname $0)
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:$CURRENTDIR/../trackdirect:$CURRENTDIR/../../heatmap-2.2.1/
|
||||
cd $CURRENTDIR/..
|
||||
python2 $CURRENTDIR/../bin/stationremover.py $CONFIGFILE $STATIONID
|
||||
exit 0
|
||||
fi
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "No arguments supplied"
|
||||
echo "$0 [config file]"
|
||||
exit
|
||||
fi
|
||||
|
||||
CONFIGFILE=$1
|
||||
|
||||
if ps -eo pid,pgid,cmd | grep -v grep | grep "bin/wsserver.py --config $CONFIGFILE" ; then
|
||||
exit 0
|
||||
else
|
||||
CURRENTDIR=$(dirname $0)
|
||||
|
||||
export PYTHONPATH=$PYTHONPATH:$CURRENTDIR/../trackdirect:$CURRENTDIR/../../heatmap-2.2.1/
|
||||
cd $CURRENTDIR/..
|
||||
python2 $CURRENTDIR/../bin/wsserver.py --config $CONFIGFILE
|
||||
exit 0
|
||||
fi
|
||||
Loading…
Reference in New Issue