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. Sat Dec 21, 2024 12:58
SMSTools3 Community » Help and support Bottom

eventhandler custom script: sms file not found

Login and Post Reply

Page:  1

Author Post
Member
Registered:
Feb 2017
Location: Germany
Operating system name and version: Debian 7.3 linux-voyage
Version of smsd: 3.1.5
Smsd installed from: preinstalled on FoxboxGT
Name and model of a modem / phone: Novatel Wireless Expedite EU850D/EU860D/EU870D
Interface: USB

Hello,
i have a problem witch the eventhandler:
after receiving a message, the eventhandlerGSM2 is called and starts a custom script witch the following command ($2 is the filename of the sms):

eventhandlerGSM2:


This script makes a copy of the message from the spool directory /var/spool/sms/incoming/GSM2.xxxxxx to another folder with following command:



This runs well but sometimes (about 1 of 10 messages) the script gives an error and the message could not be copied. This is the output from the smsd.log:




It seems that the smsd removes the message before the eventhandler has finished. If i insert a sleep 3 into the eventhandler before the custom script will be executed, every message produces this error:



How can i be sure that every message will be processed correctly? Does the smsd wait for the eventhandler?

best regards,
Frank

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Smsd waits for the eventhandler, and when talking about received messages, smsd never deletes them.

After googling for FoxboxGT, it seems that it has PlaySMS installed and running. The problem probably is that the PlaySMS is polling incoming folder, and it deletes messages after it has processed them. But PaySMS does not notice that there can be eventhandler which still needs the file.

As a solution I suggest to create a new folder /var/spool/sms/incoming_copy and in the begin of your eventhandler make a copy of message into that folder. Also change PlaySMS to use incoming_copy folder instead of incoming folder. After this change incoming messages in incoming folder are never deleted, and PlaySMS can delete messages from incoming_copy freely.

In the 3.1.16 there is a global setting incoming_copy available for this purpose.

Member
Registered:
Feb 2017
Location: Germany
Topic owner
Quote
smsd never deletes them.

Thats a good news. I have already read about the setting incoming_copy but at the moment it is not possible to update to 3.1.16. So first i will take a look at PlaySMS and try to disable it.
Thank you for the quick reply!

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
If you need to use PlaySMS, or it cannot be disabled, here is one more thing which may help:

It seems that "incoming" directory in PlaySMS is hardcoded, so we could use a directory other than that.

In the global part of smsd.conf change the incoming directory:
incoming = /var/spool/sms/smsd_incoming

In the eventhandler make a copy of a message for PlaySMS:
#!/bin/bash

if [ "$1" = "RECEIVED" ]; then
 
  MODEM=`formail -zx Subject: < $2`
  FILE2=`mktemp /var/spool/sms/incoming/${MODEM}.XXXXXX`
  cp $2 $FILE2

fi
 
'bash' Syntax Highlight powered by GeSHi


After this the PlaySMS can see the new file, and delete it after it was read.
Your eventhandler continues without problems, because nobody removes the file in smsd_incoming directory.

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.