mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-06-06 14:46:27 +02:00
Fix gammu adapter, first version of gammu sms parser
This commit is contained in:
parent
d252f88595
commit
fcc438af3c
4 changed files with 60 additions and 53 deletions
30
bin/gammu_sms_parser.sh
Executable file
30
bin/gammu_sms_parser.sh
Executable file
|
@ -0,0 +1,30 @@
|
|||
#!/bin/sh
|
||||
date=$(date +%Y%m%d%H%M%S%N)
|
||||
first_time=1
|
||||
|
||||
RECEPTION_DIR='/opt/raspisms/datas/gammu'
|
||||
|
||||
if [ ! -d $RECEPTION_DIR ]
|
||||
then
|
||||
mkdir "$RECEPTION_DIR"
|
||||
fi
|
||||
|
||||
for i in `seq $SMS_MESSAGES` ; do
|
||||
eval "sms_number=\"\${SMS_${i}_NUMBER}\""
|
||||
eval "sms_text=\"\${SMS_${i}_TEXT}\""
|
||||
|
||||
if [ $first_time -eq 1 ]
|
||||
then
|
||||
sms="$sms_number:"
|
||||
first_time=0
|
||||
fi
|
||||
|
||||
sms="$sms$sms_text"
|
||||
done
|
||||
|
||||
if [ -z "$SMS_MESSAGES" ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "$sms" >> "$RECEPTION_DIR/$PHONE_ID-${date}.txt"
|
Loading…
Add table
Add a link
Reference in a new issue