SMS Server Tools 3
This site is hosted by Kekekasvi.com
 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. Please login or register. Sun May 19, 2024 21:25
SMSTools3 Community » Help and support Bottom

[answered] regular run stop work

  This topic is locked

Page:  1

Author Post
Member
Registered:
Dec 2009
Location: vi, Argentina
Operating system name and version: Ubuntu 8.04 Server
Version of smsd: Version 3.1.3
Smsd installed from: sources
Name and model of a modem / phone: Bus 001 Device 003: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem
Interface: USB

Hello I have installed SMStools3 and work fine, but now I start using some scripts for regularrun and Eventhandler too, but this scripts stop to work while smstools3 still working.

They are scripts of sql that connect to oracle database to pick up some sms to send.

When start smstools3 the scripts work fine, but later stop to work. If I run the script manually they work fine. When regularrun fail Smstools3 send and recive fine. On the smstolls3 log I can find the line "smsd: Running a regular_run" but scrtipt is not run.

So my conclusion is that smstools3 stop working scripts regular_run and Eventhandler.

Can any help me? , regards juan manuel.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
It sounds like the script just stops working, but I cannot guess a reason without seeing the script.

Probably you have defined running regular_run in the global part of smsd.conf? In this case, the mainprocess will run it. Receiving will work because it's done by the modem process. However, as you said that sending also works fine, mainprocess should be still able to spool messages. This means that the script cannot be freezed. If there was abnormal (other than zero) return value, it is reported in the log. Was there such kind of line as "Regular_run returned <number>"?

As you have installed smsd from the sources, you could upgrade it to 3.1.6. This version will report abnormal return values from the scripts, and also execution time which may be useful information.

How do you know that the script is not run when it should be run? Do you use some debug printing in the script, like echo "Starting" >> /tmp/smsd_script_debug?

Member
Registered:
Dec 2009
Location: vi, Argentina
Topic owner
keke thanks for reply soo fast

This is a copy of my smsd.conf



This is a extract of the log /var/log/smsd.log



This is a copy of the script, look that the script go to Oracle database and pick up a message if found on the table SQL_TABLE_COLA.

#!/bin/bash

# Nombre:  
# Fecha Creacion:  
# Fecha Ultima Modificacion: --
# Autor: Juan Manuel Perrote
# Objetivo: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Uso: Automatizado
# Comentario 1 : --
# Usuario que ejecuta : root
# Maquina :  
# Historia: --

################################################
#variables de conexion a la BD

SQL_INSTANCIA=PROD
SQL_USER=smsuser
SQL_PASSWORD="enviar"
SQL_TABLE_COLA=tb_sms_cola
SQL_TABLE_stats=tb_sms_estadistica
date1="$(which date)"
formail1="$(which formail)"
ls1="$(which ls)"
cat1="$(which cat)"
echo1="$(which echo)"
path_scripts=/smsgateway/smstools3/stats

################################################
# Parametros de conexion a la BD
SQL_ARGS=" -S $SQL_USER/$SQL_PASSWORD@$SQL_INSTANCIA"

########################################################################################
#Actualizacion de estadisticas

file=`$ls1 -la $path_scripts  | grep counter | awk '  { print $8 } '`
contador=`$cat1 $path_scripts/$file | awk ' { print $2 } '`
DATE=`$date1 +"%d%m%Y%H%M%S"`

#Actualizar registro en la base de datos

$echo1 "update $SQL_TABLE_stats set cantidad_sms = $contador, fecha = to_date('$DATE','DD/MM/RRRR HH24:MI:SS') ;" |  $ORACLE_HOME/sqlplus/sqlplus $SQL_ARGS

################################################
#Leer cola de la BD , enviar el sms limpiar cola

registros=`$echo1 "select count(*) from $SQL_TABLE_COLA;" | /clienteoracle/sqlplus/sqlplus $SQL_ARGS`

if [ $registros -ne 0 ];then

for ((  i = 1 ;  i <= $registros;  i++  ))
do
       #selecciono siempre el primer registro a leer y borrar
       idcola=`$echo1 "select min(idcola) from $SQL_TABLE_COLA where fecha = (select min(fecha) from $SQL_TABLE_COLA);" | /clienteoracle/sqlplus/sqlplus $SQL_ARGS`

       mensaje=`$echo1 "select mensaje from $SQL_TABLE_COLA where idcola  = (select min(idcola) from $SQL_TABLE_COLA  where fecha = (select min(fecha) from $SQL_TABLE_COLA));" | /clienteoracle/sqlplus/sqlplus $SQL_ARGS`

       To=`$echo1 "select para from $SQL_TABLE_COLA where idcola = (select min(idcola) from $SQL_TABLE_COLA where fecha = (select min(fecha) from $SQL_TABLE_COLA));" | /clienteoracle/sqlplus/sqlplus $SQL_ARGS`

        #####crear archivo sms para enviar#####
        Para=`$echo1 $To`
        TEXTO=`$echo1 $mensaje`
        FILENAME=`mktemp /var/spool/sms/outgoing/sms_salidaXXXXXX`
        $echo1 "To: $Para" >$FILENAME
        $echo1 "" >> $FILENAME
        $echo1 "$TEXTO" >>$FILENAME
        ######################################

       #borrar el primer registro leido de la cola y continuar con el siguiente
       $echo1 "delete from $SQL_TABLE_COLA where idcola = $idcola;" | /clienteoracle/sqlplus/sqlplus $SQL_ARGS  
done

fi
 
 
'bash' Syntax Highlight powered by GeSHi


When smstools3 run a regular_run (looking the log) and do nothing I run a regular_run manually and the script work fine, all messages on the table are pick up and send.

Regards
Juan Manuel.


« Last edit by keke on Mon Dec 07, 2009 17:15, 175 months ago. »
Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
First, you need to change memory_start = 0 in the configuration. In this post the same modem was used and it was working with that value.

If you have upgraded to 3.1.6, you may use check_memory_method = 2 which is little bit better than a default method.

You may also need init2 = AT^CURC=0 if running later version than 3.1.3.

One thing I would like to confirm: When you have started smsd, eventhandler works correctly when messages are received, and regular_run can spool messages from the database when there are some messages, right? So everything works as expected, but later does not work. How long smsd has been running when this problem occurs? And when regular_run does not spool messages, and there surely are messages available in the database, have you tried to restart the smsd? In this point it is important to not to call your script manually, let regular_run do it. Are those messages sent after restarting?

How have you detected that eventhandler is first working, but not later?

Member
Registered:
Dec 2009
Location: vi, Argentina
Topic owner
Hello keke

First I change the memory_start to 0 and the error 321 dissapear , thanks.

Second: I do the following:
Put a "echo hello "at the top of my scripts regular_run and eventhandler and this work fine, when each regular_run run the echo message work.
So I think that my script sql not work propertly. Start working at the beginning, but later stop. May I recreate this script on the DB side.

For the momment I have no plan to upgrade to version 3.1.6, I think this is not necessary for the momment, whats you think about ?

Other question: When query the database to pick up a message and create a file to send SMS where I have put my file to send, in checked folder or outgoing folder ?


Regards
Juan Manuel.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
jmpatagonia wrote
Put a "echo hello "at the top of my scripts regular_run and eventhandler and this work fine, when each regular_run run the echo message work.
So I think that my script sql not work propertly. Start working at the beginning, but later stop. May I recreate this script on the DB side.

You may also log any output of SQL commands to the log file. Perhaps this kind of log will help to detect what's going wrong.

jmpatagonia wrote
For the momment I have no plan to upgrade to version 3.1.6, I think this is not necessary for the momment, whats you think about ?

It has lot of new features, but as long as you do not need or use them, there is no reason to upgrade. At least logging is better in 3.1.6, see the version history and search smart_logging.

jmpatagonia wrote
Other question: When query the database to pick up a message and create a file to send SMS where I have put my file to send, in checked folder or outgoing folder ?

Outgoing folder is the correct place. Later, if you start to use queues and checkhandler, it's mandatory to use outgoing folder.

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.