dasi66: I can see what's happening now.
If GSM1 lost network connection and while that happens sending an sms. The following happens:
The first sms is correctly sent by GSM2 as the eventhandler should but then the modem disconnects.
2020-11-19 22:21:46,6, GSM2: SMS To: 12345667. Moved file /var/spool/sms/GSM2/send_s0uf88 to /var/spool/sms/sent/send_s0uf88
2020-11-19 22:21:46,7, GSM2: Running eventhandler: /usr/local/bin/smsd_eventhandler SENT /var/spool/sms/sent/send_s0uf88 209
2020-11-19 22:21:46,7, GSM2: Done: eventhandler, execution time 0 sec., status: 0 (0)
2020-11-19 22:21:48,3, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
2020-11-19 22:21:56,6, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
...
...
2020-11-19 22:22:35,5, smsd: SMS To: 1234567. Moved file /var/spool/sms/outgoing/send_Qb08Qt to /var/spool/sms/GSM1
2020-11-19 22:22:36,6, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
2020-11-19 22:22:44,6, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
2020-11-19 22:22:52,6, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
2020-11-19 22:23:00,6, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
2020-11-19 22:23:08,6, GSM1: Couldn't connect socket @192.168.2.20:4001, error: No route to host, waiting 5 sec.
2020-11-19 22:23:16,3, GSM1: Cannot open socket @192.168.2.20:4001, error: No route to host
2020-11-19 22:23:16,2, GSM1: Modem handler 0 terminated. PID: 23382, was started 20-11-19 22:17:53, up 5 min.
2020-11-19 22:23:16,2, smsd: Modem handler 0 (GSM1) terminated while mainprocess is still running. Exited, status 127.
After that every sms is stuck in the GSM1 queue.
Can I in some way check for the string 2020-11-19 22:23:16,2, smsd: Modem handler 0 (GSM1) terminated while mainprocess is still running. Exited, status 127.
and force restart of smsd in the eventhandler?
|
dasi66: Sorry it works if send_xyz is forwarded to folder /var/spool/sms/failed . But if I remove GSM1 modem so only GSM2 is online the send_xyz stays in folder /var/spool/sms/GSM1 and it will not be handled by queue GSM2.
Is it a way of solving this?
Kind regards.
|
dasi66: Thanks for the answer. cannot get it to work though. Seems like the send_xyz files not movs to queue GSM2. Any ideas about that?
[root@test ~]# more /etc/smsd.conf
smart_logging=yes
eventhandler = /usr/local/bin/smsd_eventhandler
#loglevel=5
loglevel=8
failed=/var/spool/sms/failed
receive_before_send=no
delaytime=10
blocktime=10
infofile=/var/run/smsd.working
user=root
incoming=/var/spool/sms/incoming
sent=/var/spool/sms/sent
errorsleeptime=10
logfile=/var/log/smsd/smsd.log
stats_interval=3600
stats=/var/log/smsd/smsd_stats
autosplit=yes
devices=GSM1,GSM2
alarmlevel=4
pidfile=/var/run/smsd.pid
spool=/var/spool/sms/outgoing
[queues]
GSM1 = /var/spool/sms/GSM1
GSM2 = /var/spool/sms/GSM2
[GSM1]
queues = GSM1
cs_convert=yes
baudrate=115200
#pin=3342
report=no
mode=new
incoming=no
#device=/dev/ttyr01
device=@192.168.2.20:4001
#check_network=no
#queues=OTHER
rtscts=no
pre_init=no
init=ATE0
report = yes
report_device_details = yes
[GSM2]
queues = GSM2
cs_convert=yes
baudrate=115200
pin=ignore
report=no
mode=new
incoming=no
#device=/dev/ttyr01
device=@192.168.2.21:4001
#check_network=no
#queues=OTHER
rtscts=no
pre_init=no
init=ATE0
report = yes
report_device_details = yes
[providers]
GSM1=0, 1, 2, 3, 4, 5, 6, 7, 8, 9,s
GSM2=0
[root@test ~]#
[root@test ~]#
[root@test ~]#
[root@test ~]# more /usr/local/bin/smsd_eventhandler
#!/bin/bash
if [ "$1" = "FAILED" ]; then
# Check if there was Queue defined:
queue=`formail -zx Queue: < $2`
if [ "x$queue" != "xGSM2" ]; then
# Was not already handled using GSM2.
# Create a new message file:
FILE=`mktemp /tmp/send_XXXXXX`
# Copy a message and insert a Queue: header:
formail -f -I "Queue: GSM2" < $2 > $FILE
# Move message back to the spooler:
FILE2=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
mv $FILE $FILE2
fi
fi
[root@test ~]#
[root@test ~]#
[root@test ~]# ls -la /var/spool/sms/*/
/var/spool/sms/checked/:
total 0
drwxr-x---. 2 smstools smstools 6 Nov 11 16:58 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
/var/spool/sms/failed/:
total 0
drwxr-xr-x. 2 smstools smstools 6 Nov 18 13:19 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
/var/spool/sms/GSM1/:
total 12
drwxr-xr-x 2 smstools smstools 63 Nov 18 13:20 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
-rw-r--r-- 1 smstools smstools 19 Nov 18 12:18 send_P02tA3
-rw-r--r-- 1 smstools smstools 19 Nov 18 13:20 send_Xbm8qV
-rw-r--r-- 1 smstools smstools 19 Nov 18 13:12 send_XU0eLK
/var/spool/sms/GSM2/:
total 0
drwxr-xr-x 2 smstools smstools 6 Nov 18 13:19 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
/var/spool/sms/incoming/:
total 0
drwxr-x---. 2 smstools smstools 6 Nov 18 13:19 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
/var/spool/sms/outgoing/:
total 0
drwxrwx---. 2 smstools smstools 6 Nov 18 13:20 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
/var/spool/sms/sent/:
total 8
drwxr-x---. 2 smstools smstools 44 Nov 18 13:19 .
drwxr-xr-x. 9 smstools smstools 103 Nov 13 11:43 ..
-rw-r--r-- 1 smstools smstools 99 Nov 18 11:07 send_hSXKbq
-rw-r--r-- 1 smstools smstools 99 Nov 18 13:15 send_itMUFn
[root@test ~]#
|
dasi66: I plan to use 2 modems connected to one server. How should the smsd.conf look like?
GSM1 should be prio1 and GSM2 only if GSM1 fails.
If GSM1 send files into /failed/ folder i should be picked up by GSM2.
Is it a way of solving this or in some other way?
Running smstools
Arch : x86_64
Version : 3.1.19.9
|