summaryrefslogtreecommitdiff
path: root/sms.d
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2010-11-22 18:48:42 +0100
committerJonas Smedegaard <dr@jones.dk>2010-11-22 18:48:42 +0100
commita64226d33b9904fe95c76adb56174234501e86aa (patch)
tree5096a7e93ab3725588e61072f1fc4617bd006f12 /sms.d
parent4a72d57e895e6fdca8f31f1597dc451d79923ca8 (diff)
Add sample sms app: phone.
Diffstat (limited to 'sms.d')
-rwxr-xr-xsms.d/phone28
1 files changed, 28 insertions, 0 deletions
diff --git a/sms.d/phone b/sms.d/phone
new file mode 100755
index 0000000..86c1eba
--- /dev/null
+++ b/sms.d/phone
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# if an error occurs, break immediately
+set -e
+
+# Variables from Kannel sms gateway
+sms_from="$SMS_PHONE"
+sms_to="$1"
+app="$2"
+shift 2
+msg="$*"
+
+# Settings for the "mail" outgoing email command
+export smtp=mail.bitbase.dk
+export from=hp@fossasia.org
+export sender="$from"
+
+# Check keyword and break after processing if it matches
+case "$app" in
+ phone)
+ cat <<EOF | mail -s "[sms] phone $sms_from" hp@fossasia.org mb@fossasia.org
+Someone at $sms_from sent an sms to $sms_to with keyword phone
+and this message (supposedly his/her name):
+$msg
+EOF
+ exit 1
+ ;;
+esac