2
# Example tsdecrypt notify script
3
# Written by Georgi Chorbadzhiyski
5
# *** Released as PUBLIC DOMAIN ***
6
# *** Do whatever you want with this code ***
9
EMAIL_TO="georgi@unixsol.org" # !!! Change this !!!
10
EMAIL_FROM="georgi@unixsol.org" # !!! Change this !!!
11
EMAIL_SUBJECT_PREFIX="[tsdecrypt]"
12
EMAIL_PROGRAM="/usr/sbin/sendmail -t -i"
16
LOG_FILE="$LOGDIR/notify.${_IDENT}.notify.log"
18
# Environmental vars that are set by the calling process (tsdecrypt):
19
# _TS Unix timestamp of the event.
20
# _IDENT tsdecrypt ident (--ident parameter).
21
# _MESSAGE_ID Event message id (For example START, STOP, etc...).
22
# _MESSAGE_TEXT Event message text. Human readable event message.
23
# _MESSAGE_MSG Event message id lower cased and "_" is replaced with " "
25
export PATH="/bin:/usr/bin:/usr/local/bin"
28
if [ -z "${_IDENT}" -o -z "${_TS}" ]
30
echo "This script must be run from tsdecrypt."
31
echo "In order for tsdecrypt to run this script use --ident and --notify-prg options."
34
echo " tsdecrypt --ident SOURCE/CHANNEL --notify-program ./notify-script.example --camd-server x.x.x.x"
39
if [ "$LOG_ENABLED" = "yes" ]
41
LOG_DATE="$(date +%F\ %T\ %z -d @${_TS})"
42
printf "%s | %s | %-16s | %s\n" \
50
if [ "$EMAIL_ENABLED" = "yes" ]
53
echo "To: <$EMAIL_TO>"
54
echo "From: <$EMAIL_FROM>"
55
echo "Return-Path: <$EMAIL_FROM>"
56
echo "Subject: $EMAIL_SUBJECT_PREFIX ${_IDENT} ${_MESSAGE_MSG}"
57
echo "X-IDENT: ${_IDENT}"
58
echo "X-MSG-ID: ${_MESSAGE_ID}"
59
echo "X-Mailer: tsdecrypt"
61
echo "${_IDENT} ${_MESSAGE_TEXT}"