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:

-------------------------------------------------- -------------------------------------------------- --------------------------------------------------

<#! / bin / bash




ls -lt $ DIRECTORY && grep -iqrl $ PATRON $ DIRECTORY / *

if [$? -eq 0]; then

PLACE=$ (grep -irl $ PATRON $ DIRECTORY / *)

echo "The pattern $ PATRON was located at $ PLACE."


echo "The pattern $ PATRON was not found in the files present within $ DIRECTORY."


-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -


root @ AcerNitro5: /home/halley # ./
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
-------------------------------------------------- -------------------------------------------------- --------------------------------------------------
- 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.

« Last edit by AlonsoSaez12 on Sun Mar 03, 2019 18:13, 63 months ago. »