Mailcmd.sh

Aus VDR Wiki
Wechseln zu: Navigation, Suche

Skript vom mailbox-plugin.

Datei
$PATH/mailcmd.sh
#!/bin/sh
#
# mailcmd.sh
#
# source: vdr-plugin mailbox
#
# $1: name of the account
# $2: user name
# $3: is a dummy (will eventually become host-name)
# $4: is a dummy (will eventually become "POP3" | "IMAP")
# $5: number of new mails in the account
# $6: total-number of mails in the account

# CONFIG START
  INTERVAL="1"
  METHOD="0"  # '0'=mesg / '1'=play ( need mp3-plugin >= 0.9.15 )
  SOUNDFILE="/mp3/emailp.mp3"
# CONFIG END

if [ "$5" -ne 0 -a "$5" -ne -1 ] ; then
    logger -t ${0##*/} "===================================="
    logger -t ${0##*/} "AccountName : $1"
    logger -t ${0##*/} "UserName    : $2"
    logger -t ${0##*/} "New / Total : $5 / $6"
    logger -t ${0##*/} "===================================="
    c=0
    until [ $c -eq ${INTERVAL:-1} ] ; do
	case $METHOD in
	     0) svdrpsend.pl -p ${VDR_PORT:-2001} -d ${VDRDEST:-127.0.0.1} MESG ""$"New m@il in"" $1 ..." ;;
	     1) svdrpsend.pl -p ${VDR_PORT:-2001} -d ${VDRDEST:-127.0.0.1} PLUG mp3 PLAY "$SOUNDFILE" ;;
	esac
	c=$((c+1))
	sleep 3s
    done
fi

exit $?