From 4d85491f67a00c16c1d61795ecd0d13c9bb57329 Mon Sep 17 00:00:00 2001 From: bradanlane Date: Fri, 8 Jan 2016 16:02:57 -0500 Subject: [PATCH] start/stop gen_gdl90 directly fron init.d-stratux --- .gitignore | 1 + Makefile | 4 ---- init.d-stratux | 7 ++++--- main/gen_gdl90.go | 6 +++++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 211bb360..c06d01a8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ dump978/uat2esnt dump978/uat2json dump978/uat2text gen_gdl90 +libdump978.so *.mp4 diff --git a/Makefile b/Makefile index 38b9bc84..b87482c8 100644 --- a/Makefile +++ b/Makefile @@ -66,11 +66,7 @@ www: install: cp -f gen_gdl90 /usr/bin/gen_gdl90 chmod 755 /usr/bin/gen_gdl90 - cp start_uat.sh /usr/bin/start_uat cp init.d-stratux /etc/init.d/stratux - cp start_stratux.sh /usr/sbin/stratux - chmod 755 /usr/bin/start_uat - chmod 755 /usr/sbin/stratux chmod 755 /etc/init.d/stratux ln -sf /etc/init.d/stratux /etc/rc2.d/S01stratux ln -sf /etc/init.d/stratux /etc/rc6.d/K01stratux diff --git a/init.d-stratux b/init.d-stratux index ca71aa62..25a4f45b 100755 --- a/init.d-stratux +++ b/init.d-stratux @@ -13,7 +13,7 @@ ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin -DAEMON_SBIN=/usr/sbin/stratux +DAEMON_SBIN=/usr/bin/gen_gdl90 DAEMON_DEFS= DAEMON_CONF= NAME=stratux @@ -22,14 +22,14 @@ PIDFILE=/var/run/stratux.pid [ -x "$DAEMON_SBIN" ] || exit 0 -DAEMON_OPTS="-B -P $PIDFILE $DAEMON_OPTS $DAEMON_CONF" +DAEMON_OPTS="" . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" - start-stop-daemon --start --oknodo --quiet --exec "$DAEMON_SBIN" \ + start-stop-daemon --start --background --oknodo --quiet --exec "$DAEMON_SBIN" \ --pidfile "$PIDFILE" --make-pidfile -- $DAEMON_OPTS >/dev/null log_end_msg "$?" ;; @@ -37,6 +37,7 @@ case "$1" in log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_SBIN" \ --pidfile "$PIDFILE" + pkill dump1090 || true log_end_msg "$?" ;; reload) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 0bfb8062..a8c83a88 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -1196,6 +1196,7 @@ func main() { develFlag := flag.Bool("developer", false, "Developer mode") replayFlag := flag.Bool("replay", false, "Replay file flag") replaySpeed := flag.Int("speed", 1, "Replay speed multiplier") + stdinFlag := flag.Bool("uatin", false, "Process UAT messages piped to stdin") flag.Parse() @@ -1312,7 +1313,7 @@ func main() { } } - } else { + } else if *stdinFlag == true { for { buf, err := reader.ReadString('\n') if err != nil { @@ -1324,5 +1325,8 @@ func main() { relayMessage(msgtype, o) } } + } else { + // wait indefinitely + select {} } }