Sending SMS to phone group in custom script

Hello!

I’ve created a phone group to group all the user allowed to control (activate/deactive) the outputs of my RUT956.

I also succeeded to send a simple sms to one or more phone number with the command line :
gsmctl --sms --send “0033601020304 OFF”

I need to send an SMS to all the users of my phone group.
But I don’t know how to access this group in my user script.
Can someone help me on that subject please ?

right now I have this little script:

#!/bin/sh
ubus call ioman.relay.relay0 update ‘{“state”:“open”}’
sleep 1
gsmctl --sms --send “0033601020304 OFF”
sleep 1
gsmctl --sms --send “0033601020305 OFF”

I want to replace the sending of each sms by a loop on each number of the group, is it possible?

Thank you.

Hello,
Try this:

#!/bin/sh

ubus call ioman.relay.relay0 update ‘{“state”:“open”}’
uci show user_groups.1.tel | cut -d "=" -f 2 | sed -e "s/'//g" -e "s/+/00/g" | xargs -n 1 | while read s; do sleep 1; gsmctl --sms --send "$s OFF"; done

for phone numbers in list number 1. Replace by 2.tel for list number 2 and so on.

Regards,

Hello !
Sorry for my late reply.
Thank you for your help, I will try that as soon as possible !

Have a nice day!

Try without the sed command it might not be needed.