Mailcmd.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(M)
(M)
Zeile 8: Zeile 8:
 
#
 
#
 
# source: vdr-plugin mailbox
 
# 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
# get params
+
  LOGGER="true"
#------------------------------------------------------------------
+
# CONFIG END
CMDNAME=`basename $0`
+
ACCOUNTNAME=$1
+
USERNAME=$2
+
# $3 is a dummy (will eventually become host-name)
+
# $4 is a dummy (will eventually become "POP3" | "IMAP")
+
COUNT_NEW=$5
+
COUNT_TOTAL=$6
+
  
#------------------------------------------------------------------
+
PATH=$PREFIX/bin:$PREFIX/sbin:$PATH
# set some variables
+
#------------------------------------------------------------------
+
LOGCMD="logger -t $CMDNAME"
+
  
#------------------------------------------------------------------
+
if [ "$5" -ne 0 ] ; then
# log the parameters
+
    if [ "$LOGGER" = true ] ; then
#------------------------------------------------------------------
+
logger -t ${0##*/} "========================================================"
$LOGCMD "========================================================"
+
logger -t ${0##*/} "AccountName : '$1'"
$LOGCMD "AccountName : '$ACCOUNTNAME'"
+
logger -t ${0##*/} "UserName    : '$2'"
$LOGCMD "UserName    : '$USERNAME'"
+
logger -t ${0##*/} "New / Total : '$5 / $6'"
$LOGCMD "New / Total : $COUNT_NEW / $COUNT_TOTAL"
+
logger -t ${0##*/} "========================================================"
$LOGCMD "========================================================"
+
    fi
 
+
     svdrpsend.pl -p ${VDR_PORT:-2001} MESG "New mail in $1"
#------------------------------------------------------------------
+
# send a message to vdr
+
#------------------------------------------------------------------
+
if [ "$COUNT_NEW" -ne "0" ] ; then
+
     svdrpsend.pl -p ${VDR_PORT:-2001} MESG "New mail in $ACCOUNTNAME"
+
 
fi
 
fi
  

Version vom 3. August 2005, 21:42 Uhr

Script 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
  LOGGER="true"
# CONFIG END

PATH=$PREFIX/bin:$PREFIX/sbin:$PATH

if [ "$5" -ne 0 ] ; then
    if [ "$LOGGER" = true ] ; then
	logger -t ${0##*/} "========================================================"
	logger -t ${0##*/} "AccountName : '$1'"
	logger -t ${0##*/} "UserName    : '$2'"
	logger -t ${0##*/} "New / Total : '$5 / $6'"
	logger -t ${0##*/} "========================================================"
    fi
    svdrpsend.pl -p ${VDR_PORT:-2001} MESG "New mail in $1"
fi

exit $?