-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathauto-start-modem
More file actions
74 lines (60 loc) · 1.98 KB
/
auto-start-modem
File metadata and controls
74 lines (60 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
NOTES(){
I had a very specific need where I wanted to be able to start either
the packet modem or VARA FM when the Pi booted. It needed to both give
the user a choice of modems and work automatically without having to
VNC into the Pi first. This script will do just that.
If the sound card is connected before boot then the packet modem will
be started. If the sound card is not connected at boot, then direwolf will
fail to start. The script detects the failure and then waits on the
sound card to be connected and auto start VARA FM once the sound card is
connected.
It will also post a message to the pat outbox indicating which modem
was started. This outgoing message is addressed to "test" so if it is
accidentally sent, it will simply return to the user.
INSTALL:
Download this script and make it executable. The link to it in cron.
EXAMPLE CRON
@reboot /path/to/script/auto-start-modem
DEPENDS:
Direwolf
ax25
vara fm
pat winlink
pat menu
Hope it helps you!
73, de KM4ACK
07OCT2022
}
export DISPLAY=:0
#this function is used to post a message in the outbox to
#give the operator feedback as to which modem has started.
POSTMAIL(){
echo "$MODEM is running" | pat compose test -s "$MODEM started"
}
#this works with a sound card connected but fails if sound card not found
$HOME/patmenu2/start-pat2m &
sleep 10
#This checks to see if direwolf started
if [ -z `pidof direwolf` ]; then
#if direwolf not running, enter loop and wait on sound card to be connected.
while [ -z `arecord -l | grep card` ]; do
echo "wait on Sound card"
sleep 2
done
$HOME/patmenu2/start-vara-fm #start vara fm modem
MODEM=VARA-FM #set modem variable
#verify vara modem started.
VARA=$(ps aux | grep wine | grep VARA | head -1 | awk '{print $2}')
if [ -z $VARA ]; then
MODEM=FAILED #set modem variable
POSTMAIL #post message to outbox
else
MODEM=VARA-FM #set modem variable
POSTMAIL #post message to outbox
fi
else
MODEM=Direwolf #set modem variable
POSTMAIL #post message to outbox
exit
fi