Skip to content

Add option to use SCREEN instead of X for remote console #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 47 additions & 11 deletions dw-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,32 @@
# Some adjustments might be needed for other Linux variations.
#

#
# For normal operation as TNC, digipeater, IGate, etc.
# Print audio statistics each 100 seconds for troubleshooting.
#

DWCMD="direwolf -a 100"

#
# Set the logfile location
#

LOGFILE=/tmp/dw-start.log

#
# When running from cron, we have a very minimal environment
# including PATH=/usr/bin:/bin.
#

export PATH=/usr/local/bin:$PATH

# First wait a little while in case we just rebooted
# and the desktop hasn't started up yet.
#
# If we are going to use screen, we put our screen binary in
# the USESCREEN variable, otherwise, set it to 0

USESCREEN=/usr/bin/screen

sleep 30
LOGFILE=/tmp/dw-start.log

#
# Nothing to do if it is already running.
Expand All @@ -41,6 +54,35 @@ then
exit
fi

# First wait a little while in case we just rebooted
# and the desktop hasn't started up yet.
#

sleep 30

#
# If we are going the SCREEN route, then we need to
# see if we have a session open and if not, open it.
#
if [ -x $USESCREEN ]
then

# If there is no screen running, then we need one to attach to
#
if screen -list | awk '{print $1}' | grep -q "direwolf$"; then
echo "screen direwolf already exists" >> $LOGFILE
else
echo "creating direwolf screen session" >> $LOGFILE
screen -d -m -S direwolf
fi
sleep 1

screen -S direwolf -X screen -t Direwolf $DWCMD
exit 0

fi


#
# In my case, the Raspberry Pi is not connected to a monitor.
# I access it remotely using VNC as described here:
Expand All @@ -50,7 +92,7 @@ fi
# Otherwise default to :0.
#

date >> /tmp/dw-start.log
date >> $LOGFILE

export DISPLAY=":0"

Expand All @@ -65,12 +107,6 @@ echo "DISPLAY=$DISPLAY" >> $LOGFILE

echo "Start up application." >> $LOGFILE

#
# For normal operation as TNC, digipeater, IGate, etc.
# Print audio statistics each 100 seconds for troubleshooting.
#

DWCMD="direwolf -a 100"

# Alternative for running with SDR receiver.
# Piping one application into another makes it a little more complicated.
Expand Down