Debian Codegraph @

contrib/gsmsmsspool

raw symbols SCIP
1 #! /bin/bash
2 #
3 # /usr/bin/gsmsmsspool: Queues SMS for sending
4 #
5 # written by Matthias Goebl <[email protected]>
6
7 SPOOLDIR=/var/spool/sms
8 PRIORITIES=3
9 test -r /etc/default/gsm-utils && . /etc/default/gsm-utils
10
11 if [ -z "$1" ]; then
12 echo "Usage: gsmsmsspool NUMBER [MESSAGE]"
13 exit 1
14 fi
15
16 priority=$PRIORITIES # default priority
17 test -n "$GSMSMS_PRIORITY" && priority="$GSMSMS_PRIORITY"
18 mailto=`id -un`
19 test -n "$GSMSMS_NOTIFY" && mailto="$GSMSMS_NOTIFY"
20
21 tmpfile="$SPOOLDIR/tmp/`date +%s`.$$"
22 umask 022
23 echo "$1 $mailto" > "$tmpfile"
24 if [ -n "$2" ]; then
25 echo "$2" | head -c 160 >> "$tmpfile"
26 else
27 head -c 160 >> "$tmpfile"
28 fi
29
30 if [ "`id -un`" = "root" ]; then
31 chown gsmsms:gsmsms "$tmpfile"
32 fi
33
34 mv "$tmpfile" "$SPOOLDIR/queue$priority/"