SMS Server Tools 3
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. The forum is currently read-only, but will open soon. Thu Nov 21, 2024 12:39
SMSTools3 Community » Help and support Bottom

Input/output error after a few hours of correct operation

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Nov 2023
Location: Kazakhstan
Operating system name and version: Ubuntu server 22.04 / Linux version 5.15.0-89-generic
Version of smsd: 3.1.21
Smsd installed from: apt-get
Name and model of a modem: Huawei E171
Interface: USB

Hello, I encountered the following problem.

After a few hours of correct operation, the modem stops responding to the smds, but when I stop smsd and start it again, everything works again.

Here is the part of the log where the first errors appear:


In this case, the smsd does not turn off but continues to work and record errors in the log. SMS messages are not received at this time.
If I enter commands


then everything starts working properly again


Here are the smsd settings:

/etc/smsd.conf


ucsautoconvert
#!/bin/bash

if [ "$1" == "RECEIVED" ]; then

  if sed -e '/^$/ q' < "$2" | grep "^Alphabet: UCS2" > /dev/null; then
    TMPFILE=`mktemp /tmp/smsd_XXXXXX`
    sed -e '/^$/ q' < "$2" | sed -e 's/Alphabet: UCS2/Alphabet: UTF-8/g' > $TMPFILE
    sed -e '1,/^$/ d' < "$2" | iconv -f UNICODEBIG -t UTF-8 >> $TMPFILE
    mv $TMPFILE "$2"
  fi

fi
 
'bash' Syntax Highlight powered by GeSHi




sms2sql
#!/bin/bash


SQL_HOST=localhost
SQL_USER=user
SQL_PASSWORD="***"
SQL_DATABASE=smsd
SQL_TABLE=sms_log
PATHSMS="/var/spool/sms/incoming";

DATE=`date +"%Y-%m-%d %H:%M:%S"`
#Extract data from the SMS file
FROM=`formail -zx From: < $2 | sed 's/"//g'`
TO=`formail -zx To: < $2`
#Remove plus sign, spaces, minus and short number prefix
TO=`echo "$TO" | sed 's/ //g' | sed 's/+//g' | sed 's/s//g' | sed 's/-//g'`
SUBJECT=`formail -zx Subject: < $2`
SENT=`formail -zx Sent: < $2`
TEXT=`sed -e '1,/^$/ d' < $2`
TEXTSQL=$(echo "$TEXT" | sed 's/\\/\\\\/g' | sed 's/\"/\\\"/g')

#Set some SQL parameters
if [ "$SQL_PASSWORD" != "" ]; then
  SQL_ARGS="-p$SQL_PASSWORD";
else
  SQL_ARGS="";
fi
SQL_ARGS="-h $SQL_HOST -u $SQL_USER $SQL_ARGS -D $SQL_DATABASE -s -e"

#Insert a new entry into the SQL table

if [ "$1" = "FAILED" ] || [ "$1" = "SENT" ]; then
   mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent,sender,receiver,msgid,text) values (\"$1\",\"$DATE\",\"$FROM\",\"$TO\",\"$3\",\"$TEXTSQL\");";
elif [ "$1" = "RECEIVED" ]; then
   mysql $SQL_ARGS "insert into $SQL_TABLE (type,sent,received,sender,receiver,text) values (\"RECEIVED\",\"$SENT\",\"$DATE\",\"$FROM\",\"$SUBJECT\",\"$TEXTSQL\");";
elif [ "$1" = "REPORT" ]; then
   #Extract more data from the status report file
   DISCHARGE=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Discharge_timestamp:`
   MSGID=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Message_id:`
   STATUS=`sed -e 1,/SMS\ STATUS/d < $2 | formail -zx Status: | cut -f1 -d,`

   if [ "$MSGID" != "" ]; then
     ID=`mysql $SQL_ARGS "select id from $SQL_TABLE where receiver=\"$FROM\" and type=\"SENT\" and msgid=\"$MSGID\" order by id desc limit 1;"`
     mysql $SQL_ARGS "update $SQL_TABLE set received=\"$DISCHARGE\",status=\"$STATUS\" where id=\"$ID\";"
   fi

fi

## delete all sms
rm -f $PATHSMS/*

 
 
'bash' Syntax Highlight powered by GeSHi


Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Thanks for the clear information.

Add the setting keep_open = no to the modem section. It might solve such a situation.

Member
Registered:
Nov 2023
Location: Kazakhstan
Topic owner
I did as you told Keke, it got better, now the program worked from 2023-11-27 11:52:00 to 2023-11-28 19:06:36 (about 31 hours), after that the connection to the modem was lost and why then the main process was not terminated. After some time, I manually terminated the process and launched it again, everything worked again. I was already thinking of making a daemon that would restart smstools, but the main process does not terminate, so I don’t even know what to do. Please help me.


getting started


end


Member
Registered:
Nov 2023
Location: Kazakhstan
Topic owner
keke wrote
Thanks for the clear information.

Add the setting keep_open = no to the modem section. It might solve such a situation.

the question is still relevant

Login and Post Reply

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.