5
5
# Run this from crontab periodically to check whether direwolf is running
6
6
# and force it to start up automatically.
7
7
8
+ # In order to execute this script periodically using crontab, do the following:
9
+ # 1.- Configure the script to your liking and save changes.
10
+ # 2.- Type "crontab -e" without quotes in the terminal
11
+ # 2a.- If this is your first time editing crontab, select your preferred text editor. My favorite is nano.
12
+ # 3.- Add the line below to the crontab file. This will force the script to run every minute.
13
+ #
14
+ # * * * * * /absolute/path/to/this/file/dw-start-cli.sh >/dev/null 2>&1
15
+ #
16
+ # 4.- Save and close the crontab file.
17
+ # 5.- Optional: Use top to check whether direwolf was started. I highly recommend
18
+ # testing this script by manually executing it before adding it to the crontab.
19
+ # Execute the script manually by typing: ./dw-start-cli.sh
20
+
8
21
# Versioning (this file, not direwolf version)
9
22
# -----------
10
- # v1.4 - KE5WSG - removed support for the GUI and vastly simplified the script
23
+ # v1.4 - KE5WSG - Removed support for the GUI and vastly simplified the script.
24
+ # Improved error checking and logging.
11
25
# v1.3 - KI6ZHD - added variable support for direwolf binary location
12
26
# v1.2 - KI6ZHD - support different versions of VNC
13
27
# v1.1 - KI6ZHD - expanded version to support running on text-only displays with
14
28
# auto support; log placement change
15
29
# v1.0 - WB2OSZ - original version for Xwindow displays only
16
30
17
31
# Enable (true) / disable (false) logging everything to the log file.
32
+ # Setting this to 'false' is recommended to keep from unnecessarily filling the log file.
18
33
DEBUG=false
19
34
20
35
# Where will be stored. The directory must be writable by non-root users.
@@ -33,14 +48,18 @@ DWPATH="/home/pi/direwolf"
33
48
34
49
DWCONFIG=" /home/pi/direwolf"
35
50
51
+ # Name of the direwolf configuration file.
52
+
53
+ DWCONFIGFILE=" direwolf.conf"
54
+
36
55
# Direwolf start up command. Examples for both a simple and SDR config are provided.
37
56
#
38
57
# 1. For normal operation as TNC, digipeater, IGate, etc.
39
58
# Print audio statistics each 100 seconds for troubleshooting.
40
59
# Change this command to however you wish to start Direwolf.
41
60
# Be sure to use variables as necessary when building your command.
42
61
43
- DWCMD=" $DWPATH /direwolf -a 100 -c $DWCONFIG /direwolf.conf "
62
+ DWCMD=" $DWPATH /direwolf -a 100 -c $DWCONFIG /$DWCONFIGFILE "
44
63
45
64
# ---------------------------------------------------------------
46
65
#
@@ -56,6 +75,33 @@ export PATH=/usr/local/bin:$PATH
56
75
57
76
# Error checking before attempting to start direwolf
58
77
78
+ # Check to see whether the direwolf directory exists
79
+ if ! [ -d " $DWPATH " ]; then
80
+ echo -e " ERROR: The direwolf path (DWPATH) is invalid! Aborting."
81
+ echo " -----------------------" >> $LOGFILE
82
+ date >> $LOGFILE
83
+ echo " ERROR: The direwolf path (DWPATH) is invalid! Aborting." >> $LOGFILE
84
+ exit 1
85
+ fi
86
+
87
+ # Check to see whether the direwolf application exists
88
+ if ! [ -f " $DWPATH /direwolf" ]; then
89
+ echo -e " ERROR: The direwolf application (DWPATH/direwolf) cannot be found! Aborting."
90
+ echo " -----------------------" >> $LOGFILE
91
+ date >> $LOGFILE
92
+ echo " ERROR: The direwolf application (DWPATH/direwolf) cannot be found! Aborting." >> $LOGFILE
93
+ exit 1
94
+ fi
95
+
96
+ # Check to see whether the direwolf configuration file exists
97
+ if ! [ -f " $DWCONFIG /$DWCONFIGFILE " ]; then
98
+ echo -e " ERROR: The direwolf configuration file specified cannot be found! Aborting."
99
+ echo " -----------------------" >> $LOGFILE
100
+ date >> $LOGFILE
101
+ echo " ERROR: The direwolf configuration file specified cannot be found! Aborting." >> $LOGFILE
102
+ exit 1
103
+ fi
104
+
59
105
# Check to see whether screen is installed
60
106
if ! type " screen" > /dev/null; then
61
107
echo -e " ERROR: screen is not installed. Please install using 'sudo apt-get install screen' Aborting."
@@ -76,7 +122,7 @@ if screen -list | grep -q "direwolf"; then
76
122
exit
77
123
fi
78
124
79
- # It looks like we have everything we need to start direwolf, let 's try!
125
+ # It looks like none of the errors forced the application to exit. Let 's try running direwolf !
80
126
81
127
# Wait a little while in case we just rebooted and you're using an old RPi.
82
128
# Feel free to adjust this delay as needed.
0 commit comments