From fabd532c475bb1400d7de6b69a02edd0f7f76dff Mon Sep 17 00:00:00 2001 From: Steve Magnuson Date: Thu, 10 Oct 2019 17:21:30 -0700 Subject: [PATCH] Added ENV variable to allow direwolf using pulse to start via cron --- hampi-utilities.version | 2 +- watchdog-tnc.sh | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hampi-utilities.version b/hampi-utilities.version index 08936a4..146dd52 100644 --- a/hampi-utilities.version +++ b/hampi-utilities.version @@ -1 +1 @@ -VERSION="1.2.0" \ No newline at end of file +VERSION="1.3.0" \ No newline at end of file diff --git a/watchdog-tnc.sh b/watchdog-tnc.sh index 62f9b79..5b73dbb 100755 --- a/watchdog-tnc.sh +++ b/watchdog-tnc.sh @@ -11,13 +11,13 @@ # CLI mode is suited for say a Raspberry Pi running the Jessie LITE version # where it will run from the CLI w/o requiring Xwindows - uses screen -VERSION="2.1" +VERSION="2.2.1" RUNMODE=AUTO #Where will logs go - needs to be writable by non-root users LOGFILE=/tmp/tnc.log -TNC_SCRIPT="$(command -v tnc.sh)" +TNC_SCRIPT=/usr/local/bin/tnc.sh #------------------------------------- # Main functions of the script @@ -83,9 +83,10 @@ function GUI { # including PATH=/usr/bin:/bin. # export PATH=/usr/local/bin:$PATH +export XDG_RUNTIME_DIR=/run/user/`id -u` # Check log file size. Delete it if it's too big -find /tmp -type f -name tnc.log -size +100k -delete +find /tmp -type f -name tnc.log -size +100k -delete 2>/dev/null #Log the start of the script run and re-run #date >> $LOGFILE @@ -102,9 +103,9 @@ case "${1,,}" in SCR="$($SCREEN -list | grep direwolf | tr -d ' \t' | cut -d'(' -f1 | tr -d '\n')" if [[ $SCR != "" ]] then - pgrep direwolf 2>&1 >/dev/null && exit 0 # Direwolf already running + pgrep direwolf >/dev/null 2>&1 && exit 0 # Direwolf already running fi - $TNC_SCRIPT stop 2>&1 >/dev/null + $TNC_SCRIPT stop >/dev/null 2>&1 CMD="$TNC_SCRIPT start ${1,,}" pkill -f "(terminal|x-term).*$TNC_SCRIPT" if [ $RUNMODE == "AUTO" ] @@ -128,3 +129,4 @@ case "${1,,}" in ;; esac +