From d187bd3b4805dcb3f9e1d6143ac1cd0531009868 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 19 May 2015 15:57:22 +0200 Subject: add support for executing external commands close #1 --- execute/echo.sh | 28 ++++++++++++++++++++++++++++ execute/mail.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 execute/echo.sh create mode 100755 execute/mail.sh (limited to 'execute') diff --git a/execute/echo.sh b/execute/echo.sh new file mode 100755 index 0000000..15ca215 --- /dev/null +++ b/execute/echo.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# (C) 2015 by Christian Hesse +# +# This software may be used and distributed according to the terms +# of the GNU General Public License, incorporated herein by reference. + +while getopts "i:p:m:" opt; do + case ${opt} in + i) + IDENTIFIER="${OPTARG}" + ;; + p) + PRIORITY="${OPTARG}" + ;; + m) + MESSAGE="${OPTARG}" + ;; + esac +done + +echo "IDENTIFIER: ${IDENTIFIER}" +echo "PRIORITY: ${PRIORITY}" +echo "MESSAGE: ${MESSAGE}" + +exit 0 + +# vim: set syntax=sh: diff --git a/execute/mail.sh b/execute/mail.sh new file mode 100755 index 0000000..2d757db --- /dev/null +++ b/execute/mail.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# (C) 2015 by Christian Hesse +# +# This software may be used and distributed according to the terms +# of the GNU General Public License, incorporated herein by reference. + +while getopts "i:p:m:" opt; do + case ${opt} in + i) + IDENTIFIER="${OPTARG}" + ;; + p) + PRIORITY="${OPTARG}" + ;; + m) + MESSAGE="${OPTARG}" + ;; + esac +done + +mail -s "[${PRIORITY}] ${IDENTIFIER}" mail@example.com <<< "${MESSAGE}" + +exit 0 + +# vim: set syntax=sh: -- cgit v1.2.3-54-g00ecf