chiark / gitweb /
wip
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 11 Apr 2014 14:40:21 +0000 (15:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 11 Apr 2014 14:40:21 +0000 (15:40 +0100)
.gitignore [new file with mode: 0644]
notify [new file with mode: 0644]
via-email [new file with mode: 0644]
via-sms [moved from viasms with 100% similarity]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..b25c15b
--- /dev/null
@@ -0,0 +1 @@
+*~
diff --git a/notify b/notify
new file mode 100644 (file)
index 0000000..597877e
--- /dev/null
+++ b/notify
@@ -0,0 +1,33 @@
+#!/bin/bash
+set -e
+
+case "$#.$1" in
+2.[^-]*)       ;;
+*)             echo >&2 "usage: ./notify recipientsfile 'message'"; exit 1;;
+esac
+
+rcpts="$1"
+msg="$2"
+
+exec <"$rcpts"
+line=0
+while read method data; do
+       line=$(( $line+1 ))
+       case "$method" in
+       #*|'')  continue ;;
+       [^a-z]*) echo >&2 "huh ? $rcpts:$line: $method"; continue ;;
+       log=log-$method-$line.txt
+       exec >$log
+       set +e
+       printf >&2 "sms"
+       ./"via-$method" $data 2>&1
+       rc=$?
+       set -e
+       if [ $rc != 0 ]; then
+               printf >&2 "-FAIL:%s\n" $log
+       else
+               printf >&2 " "
+       fi
+done
+exec >&2
+echo >&2
diff --git a/via-email b/via-email
new file mode 100644 (file)
index 0000000..f08d110
--- /dev/null
+++ b/via-email
@@ -0,0 +1,7 @@
+#!/bin/sh
+rcpt="$1"
+msg="$2"
+ssh -vt ijackson@tunnel.chiark.greenend.org.uk \
+ /usr/lib/sendmail -oem -odb -oi -t <<END
+To: $rcpt
+Subject: Post-pizza: $msg
diff --git a/viasms b/via-sms
similarity index 100%
rename from viasms
rename to via-sms