From e4fdc182336c738304e0699a1a9c85530b43191e Mon Sep 17 00:00:00 2001 From: davidh-ssec <david.hoese@ssec.wisc.edu> Date: Mon, 18 Dec 2017 11:23:32 -0600 Subject: [PATCH] Add influxdb ingest script to scripts --- aosstower/level_00/influxdb.py | 2 +- scripts/start_tower_influxdb_ingest.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 scripts/start_tower_influxdb_ingest.sh diff --git a/aosstower/level_00/influxdb.py b/aosstower/level_00/influxdb.py index e24ac29..145a964 100644 --- a/aosstower/level_00/influxdb.py +++ b/aosstower/level_00/influxdb.py @@ -57,7 +57,7 @@ def main(): 'of the file and insert any new data added after starting')) parser.add_argument('--ldmp', action='store_true', help='Treat `src` file as a station name and read records from LoggerNet LDMP server (port: 1024)') - parser.add_argument('--tables', nargs='*', default=['RIGTower'], + parser.add_argument('--tables', nargs='*', default=['1'], help="LoggerNet LDMP tables to read in") parser.add_argument("--host", default=influxdb.DB_HOST, help="Hostname of database connection") diff --git a/scripts/start_tower_influxdb_ingest.sh b/scripts/start_tower_influxdb_ingest.sh new file mode 100644 index 0000000..eb2dc91 --- /dev/null +++ b/scripts/start_tower_influxdb_ingest.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# +# Runs the tower ingest in a screen session named 'tower_influxdb_ingest'. +# +# If a screen session is already running with that name, exit, otherwise start +# a new detached screen session named 'tower_influxdb_ingest'. +# +NAME=tower_influxdb_ingest +PYENV=/opt/metobs/aoss_tower +#SRC=/mnt/data/ingest/rig_tower/rig_tower.dat +# LOGFN=$HOME/log/tower_db_ingest.log +# TODO: Add proper logging + +SCRN=$(screen -list | grep $NAME | awk '{print $1}') +if [ -n "$SCRN" ]; then + echo Screen already running: $SCRN +else + screen -S $NAME -d -m $PYENV/bin/python -m aosstower.l00.influxdb --host metobs01.ssec.wisc.edu -vvv --ldmp RIGTower + #screen -S $NAME -d -m "$PYENV/bin/python -m aosstower.l00.influxdb --host metobs01.ssec.wisc.edu -vvv -t $SRC > /home/metobs/log/${NAME}.log" + echo Started in screen $(screen -list | grep $NAME | awk '{print $1}') +fi \ No newline at end of file -- GitLab