Keywords: Mode: All keywords (AND) |
Sun Mar 03, 2019 18:12
|
AlonsoSaez12: My case is the following: -I have a Linux system where I have an smsd installed (SmsTools3)
-This system works through a GSM module in which I can send and receive text messages.
-Text messages arrive in a certain folder (/var/spool/sms/incoming)
-I need a script that does different things in response to an incoming SMS to the "Incoming" directory.
The idea is that each time an SMS arrives, the system analyzes the folder where these messages are received, choose the most RECENT message and execute an action on the system. What I have at the moment is this:
-------------------------------------------------- -------------------------------------------------- --------------------------------------------------
Code:
<#! / bin / bash
#Declaration
DIRECTORY=/var/spool/sms/incoming
PATRON='Reset'
#Search
ls -lt $ DIRECTORY && grep -iqrl $ PATRON $ DIRECTORY / *
if [$? -eq 0]; then
PLACE=$ (grep -irl $ PATRON $ DIRECTORY / *)
echo "The pattern $ PATRON was located at $ PLACE."
else
echo "The pattern $ PATRON was not found in the files present within $ DIRECTORY."
fi>
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -
ANSWER:
Code:
root @ AcerNitro5: /home/halley # ./script3.sh
total 8
-rw-r - r-- 1 root root 54 Mar 1 11:07 test2
-rw-r - r-- 1 root root 74 Mar 1 10:18 test1
The Reset pattern was located in /var/spool/sms/incoming/test1/ and
var/spool/sms/incoming/test2.
-------------------------------------------------- -------------------------------------------------- --------------------------------------------------
- I still have a lot to complete ... I'm a little lost on how to make the script select the text file (SMS incoming incoming) more RECENT where there is a pattern "Reset" and then run a reboot to the system.
|
Wed Jan 09, 2019 18:51
|
AlonsoSaez12: I need an example or explanation on how to use the event handler with the daemon when I receive an SMS.
I am a new user and I do not know much about scripts. I would appreciate a detailed explanation even if it is tedious for you. I would appreciate it very much.
|
Fri Jan 04, 2019 03:00
|
AlonsoSaez12: Problem solved with the indications that you gave me, it was not necessary to change the baud rate, rather "rts cts = no" solved my problem. Thanks for the patience and the time.
SOLVED.
|
Thu Jan 03, 2019 15:55
|
AlonsoSaez12: First of all, I'm sorry for the images. The virtual machine does not let me select texts in the console, I have guest additions installed and the option to share clipboards too, but every time I select a text, it deselects itself. That is why attached images.
I managed to run the program and send SMS with the sendsms command, but I have a very important question.
The error that I added previously in the last answer is repeated every time I start the program with the command /etc/init.d/sms3 start
This problem is solved every time after launching the program /etc/init.d/sms3 start, I use the command gsmctl -X -d / dev / ttyUSB0 ALL
Then, the module automatically starts communicating and the demon goes on to listen if I receive or do not receive SMS (I tried to send and receive, at this level if everything works, but it raises my doubts why the communication does not start automatically after using / etc /init.d/sms3 start, but you need the gsmctl command to start)
1-> In this image, I used the command / etc / init.d/sms3 start, but in the smsd.log, the system stays locked in the AT line, until I stop the program with / etc /init.d / sms3 stop
https://ibb.co/ssRbRwS
2-> In this stage, I already executed / etc /init.d/sms3 stop and I did / etc /init.d/sms3 restart so that you see the not working of the program.
https://ibb.co/KxhsrSW
3-> In this image, I used the gsmctl command to see the status of the GSM module. In this step, the smsd.log starts to work and the daemon starts listening normally.
https://ibb.co/Z2DK21L
4-5-> Image of the demon working normally.
https://ibb.co/c1RFWCg
https://ibb.co/hgcvKxM
I will use the configuration you gave me, I will notify you of anything.
|
Mon Dec 31, 2018 17:23
|
AlonsoSaez12: Port do you mean what device on the list? I've searched for it in cd / dev, the one that is in use by default is TTYUSB0. I have the module connected to a USB-UART.
I have checked the status of the GSM module with gsmctl -X -d / dev / ttyUSB0 ALL before trying to run SMSTOOLS3
and it has thrown me all normal Functionality is in 1.
When I used gsm utils, I used the command gsmsendsms -X -d / dev / ttyUSB0 + NNNNNNNNN 'Hello World!' And it works. The message is sent
Regarding port, I do not know exactly what you mean ... if you could explain me, or indicate where to get that information, I can upload more images. For now, I'm attaching the smsd.conf
https://ibb.co/sbHsm2C
|
Sun Dec 30, 2018 22:44
|
|
Fri Dec 28, 2018 15:24
|
AlonsoSaez12: I have connected the GSM module in another way. I am connected by a USB-UART and virtual machine with DEBIAN 9.6. I already solved the feeding problem. I have tested the module with the GSM utils program and I have sent SMS with the gsmsendsms command and it works correctly. I have also tested the sendsms command in smstools3 and it works correctly. I have done tail -f to smsd.log to verify its operation and I have a new error to show you. If you could help me, I would be very grateful. I leave the LOG image.
https://ibb.co/HF0tCGt
|
Tue Dec 18, 2018 18:33
|
AlonsoSaez12: The file was already with the value 7 by default. Attached the tail program record.
https://ibb.co/WKsLkHC (IMAGE ON LINK)
|
Tue Dec 18, 2018 16:36
|
AlonsoSaez12: Operating system name and version: Debian 9.3
Version of smsd: 3.1.15
Smsd installed from: sudo apt-get install build-essential manpages-dev
Name and model of a modem / phone: Sim800L
Interface: Windows 10 / PUTTY
I am trying to send SMS from a GSM module (Sim800L) connected to a BeagleBone Black by UART (the module is activated and is called TTYO2).
The GSM module is connected to a USB charger (5V-2A), with a chip that has 4G. The LEDs of the module restart intermittently, in addition, since the USB charger remains constant while it is plugged in. It's a weird problem, while I have the SIM connected the LEDs restart every so often, but when I remove the sim, the module seems not to restart and the LEDs remain lit.
I installed and started the instruction program and first of all, I realized that the "sendsms" command does not work from PUTTY. I have been testing the second option, to create a file inside the Outgoing Folder directory, but the sms goes to the directory of failed messages automatically. I also declared the GSM module (TTYO2) in /etc/smsd.conf.
I think that the module is badly powered or definitely that I installed or did something wrong in the smstools tool. I also printed the smsd.log record through the tail program
|