📄 gsmsmsrequeue
字号:
#! /bin/sh## /usr/bin/gsmsmsrequeue: Re-queues failed SMS and sends notifications# Contains hooks for accounting sent SMS## written by Matthias Goebl <matthias.goebl@goebl.net>SPOOLDIR=/var/spool/smsPRIORITIES=3SMSADMIN=rootSUBJECT="SMS delivery report:"function send_notify { tmpfile="$SPOOLDIR/tmp/"`basename "$1"` status="$2" if mv "$1" "$tmpfile" 2>/dev/null; then do_accounting "$tmpfile" "$status" # extract the first tab-separated field after the phone number as # email-address to send the notification to notify=` cat "$tmpfile" | sed -ne '1s/^[^ ]* \([^ ]*\).*/\1/p' ` test -z "$notify" && notify="$SMSADMIN" cat "$tmpfile" | mail -s "$SUBJECT $status" "$notify" rm "$tmpfile" fi}function do_accounting { if [ "$2" = "sent" ]; then true # it's your turn fi}test -r /etc/default/gsm-utils && . /etc/default/gsm-utilsfor p in `seq 1 $PRIORITIES`; do ls "$SPOOLDIR/failed$p" | while read file; do if expr "$file" : ".*rrrrrrrrrrrr" >/dev/null; then send_notify "$SPOOLDIR/failed$p/$file" "failed" else # re-queue SMS mv "$SPOOLDIR/failed$p/$file" "$SPOOLDIR/queue$p/${file}r" 2>/dev/null fi donedonefor p in `seq 1 $PRIORITIES`; do ls "$SPOOLDIR/sent$p" | while read file; do send_notify "$SPOOLDIR/sent$p/$file" "sent" donedone
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -