#!/bin/sh # - USB . num=`ls /dev/ttyUSB* | awk -F tty '{print $2}' | awk -F USB '{print $2}' | awk 'BEGIN { ORS = " " } { print }' | sed 's/.$//'` devlist=`ls /dev/ttyUSB* | awk -F tty '{print $2}' | awk 'BEGIN { ORS = "," } { print }' | sed 's/.$//'` # selection () { echo "["USB$i"]" >>/etc/smsd.conf echo 'init = AT+CPMS="ME","ME","ME"' >>/etc/smsd.conf echo "device = /dev/ttyUSB"$i >>/etc/smsd.conf echo "baudrate = 115200" >>/etc/smsd.conf echo "incoming = yes" >>/etc/smsd.conf echo "memory_start = 1" >>/etc/smsd.conf echo "eventhandler = /usr/local/bin/sms2mail" >>/etc/smsd.conf echo >>/etc/smsd.conf } # /etc/smsd.conf echo >/etc/smsd.conf # sms echo "devices = "$devlist >/etc/smsd.conf echo "outgoing = /var/spool/sms/outgoing" >>/etc/smsd.conf echo "checked = /var/spool/sms/checked" >>/etc/smsd.conf echo "incoming = /var/spool/sms/incoming" >>/etc/smsd.conf echo "receive_before_send = no" >>/etc/smsd.conf echo "incoming_utf8 = yes" >>/etc/smsd.conf echo >>/etc/smsd.conf # for i in $num; do selection; done
#!/bin/bash #IMSI . # - 250014712255725 # - 250014712342902 # - 250014712553982 # - 250014710661053 #$1 $2 - smsd status="$1" file="$2" # IMSI imsi=`head -12 $file | grep -e "IMSI: " | awk -F" " '{print $2}'` # case "$1" in RECEIVED) if [ $imsi = 250014712255725 ]; then name="" fi if [ $imsi = 250014712342902 ]; then name="" fi if [ $imsi = 250014712553982 ]; then name="" fi if [ $imsi = 250014710661053 ]; then name="" fi head -12 $file | grep -e "^From: " -e "^Sent: " -e "^Received: " >> /tmp/sms.log # UCS, UTF-8 if grep "Alphabet: UCS2" $file >/dev/null; then echo "$name" >> /tmp/sms.log tail -n +13 $file | iconv -f UCS-2BE -t UTF-8 >> /tmp/sms.log tail -n +13 $file | iconv -f UCS-2BE -t UTF-8 | mutt -x -s "$name" x@mail.com else echo "$name" >> /tmp/sms.log tail -n +13 $file >> /tmp/sms.log tail -n +13 $file | mutt -x -s "$name" x@mail.com fi echo >> /tmp/sms.log echo >> /tmp/sms.log ;; esac
<title>SMS-</title> <meta http-equiv="refresh" content="5;url=index.php"> <meta charset="UTF-8"> <?php $output = shell_exec('tail -n 30 /tmp/sms.log'); echo "<pre>$output</pre>"; ?>
Source: https://habr.com/ru/post/280574/
All Articles