1
0
mirror of https://github.com/AG7GN/nexus-utilities.git synced 2025-05-16 14:40:09 -07:00

Added ENV variable to allow direwolf using pulse to start via cron

This commit is contained in:
Steve Magnuson 2019-10-10 17:21:30 -07:00
parent afa5a47786
commit fabd532c47
2 changed files with 8 additions and 6 deletions

View File

@ -1 +1 @@
VERSION="1.2.0" VERSION="1.3.0"

View File

@ -11,13 +11,13 @@
# CLI mode is suited for say a Raspberry Pi running the Jessie LITE version # 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 # where it will run from the CLI w/o requiring Xwindows - uses screen
VERSION="2.1" VERSION="2.2.1"
RUNMODE=AUTO RUNMODE=AUTO
#Where will logs go - needs to be writable by non-root users #Where will logs go - needs to be writable by non-root users
LOGFILE=/tmp/tnc.log LOGFILE=/tmp/tnc.log
TNC_SCRIPT="$(command -v tnc.sh)" TNC_SCRIPT=/usr/local/bin/tnc.sh
#------------------------------------- #-------------------------------------
# Main functions of the script # Main functions of the script
@ -83,9 +83,10 @@ function GUI {
# including PATH=/usr/bin:/bin. # including PATH=/usr/bin:/bin.
# #
export PATH=/usr/local/bin:$PATH 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 # 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 #Log the start of the script run and re-run
#date >> $LOGFILE #date >> $LOGFILE
@ -102,9 +103,9 @@ case "${1,,}" in
SCR="$($SCREEN -list | grep direwolf | tr -d ' \t' | cut -d'(' -f1 | tr -d '\n')" SCR="$($SCREEN -list | grep direwolf | tr -d ' \t' | cut -d'(' -f1 | tr -d '\n')"
if [[ $SCR != "" ]] if [[ $SCR != "" ]]
then then
pgrep direwolf 2>&1 >/dev/null && exit 0 # Direwolf already running pgrep direwolf >/dev/null 2>&1 && exit 0 # Direwolf already running
fi fi
$TNC_SCRIPT stop 2>&1 >/dev/null $TNC_SCRIPT stop >/dev/null 2>&1
CMD="$TNC_SCRIPT start ${1,,}" CMD="$TNC_SCRIPT start ${1,,}"
pkill -f "(terminal|x-term).*$TNC_SCRIPT" pkill -f "(terminal|x-term).*$TNC_SCRIPT"
if [ $RUNMODE == "AUTO" ] if [ $RUNMODE == "AUTO" ]
@ -128,3 +129,4 @@ case "${1,,}" in
;; ;;
esac esac