-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup3.sh
executable file
·67 lines (54 loc) · 1.28 KB
/
setup3.sh
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
#!/bin/bash
sudo apt install gammu -y
cat <<- EOF > ~/.gammurc
[gammu]
connection = at
device = /dev/sms-proxy
synchronizetime = yes
logfile = syslog
logformat = textalldate
EOF
gammu identify
sudo apt install gammu-smsd -y
cat <<- 'EOF' > ~/process_sms.sh
#!/bin/bash
FROM="${SMS_1_NUMBER}"
MESSAGE=
MESSAGE_FILE_NAMES=("$@")
for MESSAGE_FILE_NAME in "${MESSAGE_FILE_NAMES[@]}"; do
MESSAGE_FILE="/var/spool/gammu/inbox/${MESSAGE_FILE_NAME}"
MESSAGE+="$(cat "${MESSAGE_FILE}")"
rm -f "${MESSAGE_FILE}"
done
logger "${FROM}: ${MESSAGE}" # journalctl -xef
EOF
chmod +x ~/process_sms.sh
cat <<- EOF | sudo tee /etc/gammu-smsdrc >/dev/null
[gammu]
connection = at
device = /dev/sms-proxy
synchronizetime = yes
logformat = textalldate
[smsd]
service = files
logfile = syslog
debuglevel = 1
statusfrequency = 0
checksecurity = 0
hangupcalls = 1
checkbattery = 0
checksignal = 0
checknetwork = 0
deliveryreport = log
deliveryreportdelay = 7200
runonreceive = /home/${USER}/process_sms.sh
excludenumbersfile =
inboxpath = /var/spool/gammu/inbox/
outboxpath = /var/spool/gammu/outbox/
sentsmspath = /var/spool/gammu/sent/
errorsmspath = /var/spool/gammu/error/
outboxformat = unicode
transmitformat = unicode
EOF
sudo systemctl enable --now gammu-smsd
sudo reboot