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. Tue Jul 15, 2025 02:43
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
moss2k10: Hello, We are using SMS Server Tools for almost a year now and We are very satisfied ;) Yesterday however again our phone has been disconnected because of connected USB cable flapping causing linux to randomly address USB device under different port ttyACM1 instead of ttyACM0 which exist in the sms.cfg.. :? We want to script this somehow but maybe such functionality is available already in SMS Tools ? BR, Peter
moss2k10: Hello again, I'd like to share another way to achieve scheduler functionality used in our environment (Smsd v3.1.14 on Centos 5.5) 1)Directories&Localizations: a)/var/spool/sms/temp/ - initial directory where not divided smses are placed; b)/var/spool/sms/scheduler/ - directory where divided smses are moved from a) by smsd_multisms.sh to be checked according to scheduler settings by scheduler.sh; c)/var/spool/sms/outgoing/ - final directory where smses from b) are moved to be send; d)/usr/local/bin/smsd_multisms.sh - script for dividing sms for multiple receivers; e)/usr/local/bin/smsd_scheduler.sh - main script's localization; f)/usr/local/bin/scheduler/scheduler.sh - scheduler script localization; g)/usr/local/bin/scheduler/timetable.csv - scheduler's settings file localization; h)/usr/local/bin/scheduler/numbers.txt - scheduler.sh output file localization; i)/usr/local/bin/scheduler/scheduler_errors.log - scheduler_errors log localization; 2)smsd.conf: devices = Nokia logfile = /var/log/smsd.log loglevel = 5 regular_run = /usr/local/bin/smsd_scheduler.sh regular_run_interval = 5 failed = /var/spool/sms/failed sent = /var/spool/sms/sent stats = /var/spool/sms/stats [Nokia] device = /dev/ttyACM0 pin = xxxx 3)scheduler.sh: Our network management system generates sms alerts with proper filename according to event id: f92cd309-0b4d-420c-a609-4d62459b358b_temp_sms_alert_48700800900 Scheduler.sh script is set up for the number of '_' to localize phone number - You need to set it up according to Your environment: SMS_FILES_NAME_SEP='_' SMS_FILES_PHONE_NUM_POS=5 . . . #get phone number form file name find_number=$(echo $file | cut -d $SMS_FILES_NAME_SEP -f $SMS_FILES_PHONE_NUM_POS) #!/bin/bash #lock file LOCK_FILE="/var/lock/sms_scheduler" if [ -e $LOCK_FILE ] then exit 0 else touch $LOCK_FILE fi #check args if [ $# -eq 0 ] then echo "use $0 filename" exit 0 fi #check if file exist if [ ! -e $1 ] then echo "file $1 not exist" rm $LOCK_FILE exit 0 fi #call spliter + WAIT ? /usr/local/bin/smsd_multisms.sh /var/spool/sms/temp/* #=========== read a time table file =================== FILE=$1 LINE_LENGHT=120 NUMBERS_FILE_OUT="/usr/local/bin/scheduler/numbers.txt" HOUR_SEP=':' TIME_SEP='-' ITEM_SEP=';' #empty file if [ -e $NUMBERS_FILE_OUT ]; then rm -f $NUMBERS_FILE_OUT fi #get a day(1 = monday) and shift to start week ommit phone number and mail TODAY=$(date +%u) let TODAY+=2 #get a time and convert to minutes TIME=$(expr $(date +%H) \* 60 + $(date +%M)) #echo "Time now: $TIME" #process a time table file cat $FILE | while read line do #find time rande for today timeRange=$(echo $line | cut -d \; -f $TODAY) if [ $timeRange = "24h" ]; then echo $(echo $line | cut -d $ITEM_SEP -f 1 ) >> $NUMBERS_FILE_OUT elif [ $timeRange = "no" ]; then echo "" else #get start time from give day startHour=$(echo $timeRange | cut -d $HOUR_SEP -f1) startMinute=$(echo $timeRange | cut -d $HOUR_SEP -f2 | cut -d $TIME_SEP -f 1) startTime=$( expr $startHour \* 60 + $startMinute ) # echo "Start time si: $startTime" #get stop time for give day stopHour=$(echo $timeRange | cut -d $TIME_SEP -f2 | cut -d $HOUR_SEP -f 1) stopMinute=$(echo $timeRange | cut -d $TIME_SEP -f2 | cut -d $HOUR_SEP -f2 ) stopTime=$( expr $stopHour \* 60 + $stopMinute ) # echo "Stop hour is : $stopTime" if [ $TIME -ge $startTime ] && [ $TIME -le $stopTime ]; then echo $(echo $line | cut -d $ITEM_SEP -f 1 ) >> $NUMBERS_FILE_OUT fi fi done #================== preocessing sms files ========================= #dir with sms to be send before filtering SMS_FILES_DIR_IN="/var/spool/sms/scheduler" SMS_FILES_DIR_OUT="/var/spool/sms/outgoing" SMS_FILES_NAME_SEP='_' SMS_FILES_PHONE_NUM_POS=5 #number which should be send in loop cat $NUMBERS_FILE_OUT | while read number do #sms files name ls $SMS_FILES_DIR_IN | while read file do #get phone number form file name find_number=$(echo $file | cut -d $SMS_FILES_NAME_SEP -f $SMS_FILES_PHONE_NUM_POS) if [ "$number" = "$find_number" ]; then mv -f $SMS_FILES_DIR_IN/$file $SMS_FILES_DIR_OUT fi done done rm $LOCK_FILE 4)smsd_multisms.sh: #!/bin/bash # Sample script to allow multiple recipients in one message file - author Keke temp=`ls /var/spool/sms/temp | wc -l` if [[ $temp = 0 ]] then exit 0 fi recipients=`formail -zx "To:" < "$1"` ECHO=echo messagebody=`sed -e '1,/^$/ d' < "$1"` for recipient in $recipients do file="$1_$recipient" $ECHO "To: $recipient" > $file $ECHO "" >> $file $ECHO "$messagebody" >> $file mv $file /var/spool/sms/scheduler/ done # Remove processed file: rm $1 exit 0 5)smsd_scheduler.sh: #! /bin/sh HOME="/usr/local/bin/scheduler" temp=`ls /var/spool/sms/temp/ | wc -l` scheduler=`ls /var/spool/sms/scheduler/ | wc -l` if [[ $temp = 0 && $scheduler = 0 ]] then exit 0 fi $HOME/scheduler.sh $HOME/timetable.csv >> $HOME/scheduler_errors.log 2>&1 6)timetable.csv: Settings for scheduler - You can modify these with few limitations: -seven columns are days of week (Mon to Sun hh:mm format) - after the last one there needs to be a semicolon -first hour need to be lower than second (I didn't wrote this :mrgreen: ) -number typing style needs to be the same as the one from sms format - check below SMS sample -to disable sms notification put "no" in a proper column -mail label for easy receiver's recognition 48700800900;label.mail1@test.com;8:00-16:00;8:00-16:00;8:00-16:00;8:00-16:00;8:00-16:00;no;no; 48700800901;label.mail2@test.com;8:00-16:00;8:00-16:00;8:00-16:00;8:00-16:00;8:00-16:00;no;no; 48700800902;label.mail3@test.com;24h;24h;24h;24h;24h;24h;24h; 7)SMS sample: To: 48700800900 48700800901 48700800902 Area: CA Time: 2011/01/21 20:55:50.000 Type: UPS PROBLEM Device: TEPLSZCUPS004 Message: The temperature on TEPLSZCUPS004 is over 24 degrees. Once more I would like to thank Keke for his support in this project - You made many admin's lives much more comfortable now ;)
moss2k10: Hello Keke, Thanks for Your support - I'm sure that I'm not the only one who will use it:) With some friends @ work we are currently working on another way to achieve scheduler functionality - I will of course post it when we will finish testing. Best regards, Peter
moss2k10: Hello Keke:) My business colleges want to be informed by sms only in exact time intervals, for example Mon-Fri from 8:00 to 16:00. Do we have any solution already implemented in smsservertools for it or I need to script this by myself? Little example: we have a corporate service failure on Friday night around midnight which lasts until Monday morning..we don't want to be bothered in the weekend so we should get an sms on Monday morning according to time intervals from above (Mon-Fri from 8:00 to 16:00). Thanks in advance, Peter
moss2k10: This is exactly what I've been looking for - now our NMS alerts work epicly :mrgreen: Big thanks for Your help Keke! Peter
moss2k10: Of course Keke - I've noticed this after I post my reply ;) One more thing: your script generates random temp file names: do file=`mktemp $outgoing/send_XXXXXX` Is there a chance to stay with original names with only tiny changes for example: originalnameofsms_1,2,3? In our case the name of the sms is the name of event and it's quite needed for troubleshooting.. Thanks, Peter
moss2k10: Sorry for bothering You about something that was already solved before Keke :] But I'm having some problems with using this script: My smsd.conf: devices = NokiaE51 logfile = /var/log/smsd.log loglevel = 5 shell = /bin/bash executable_check = yes checkhandler = /etc/multisms.conf sent = /var/spool/sms/sent stats = /var/spool/sms/stats spool_directory_order = yes [NokiaE51] device = /dev/ttyACM0 incoming = yes pin = xxxx Your sample script /etc/multisms.conf: #!/bin/bash # Sample script to allow multiple recipients in one message file. # Define this script as a checkhandler. outgoing="/var/spool/sms/outgoing" recipients=`formail -zx "To:" < "$1"` #count=`echo "$recipients" | wc -l` count=`echo "$recipients" | wc -w` if [ $count -gt 1 ]; then # Will need echo which accepts -n argument: ECHO=echo case `uname` in SunOS) ECHO=/usr/ucb/echo ;; esac messagebody=`sed -e '1,/^$/ d' < "$1"` headers=`formail -X "" -I "To:" -f < "$1"` for recipient in $recipients do file=`mktemp $outgoing/send_XXXXXX` $ECHO "To: $recipient" > $file if [ "x$headers" != "x" ]; then $ECHO "$headers" >> $file fi $ECHO "" >> $file $ECHO -n "$messagebody" >> $file done # Remove processed file: rm $1 # Tell to smsd that checkhandler has spooled this message: exit 2 fi exit 0 Result when I'm trying to restart smsd: service sms3 start Starting SMS Daemon: Checkhandler /etc/multisms.conf is not executable for smsd. There was 1 major problem found. Cannot start. See the log file for details. smsd failed. My smsd version: smsd: Smsd v3.1.14 started
moss2k10: Hello, I was looking for this feature, but I didn't find it. I'm using SMSTools in our NMS to send sms alerts. Everything works great, but I can't send the same alert to many persons - at this moment I'm making new sms for every one..The question is:what should the message form look like to be send to many numbers?Below there are some examples which I tried, but without success: 1) To: 48600700800; 48600700801 SMSmessage 2) To: 48600700800 To: 48600700801 SMSmessage 3) To: 48600700800 48600700801 SMSmessage Thanks in advance for any help in this topic. Peter

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.