Mailcmd.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 1: Zeile 1:
#!/bin/sh
+
<pre>
#
+
#!/bin/sh
# mailcmd.sh - v.0.1
+
#
#
+
# mailcmd.sh
# source: [[mailbox-plugin]]
+
#
+
# source: vdr-plugin mailbox
#------------------------------------------------------------------
+
 
#    get params
+
#------------------------------------------------------------------
#------------------------------------------------------------------
+
#    get params
CMDNAME=`basename $0`
+
#------------------------------------------------------------------
ACCOUNTNAME=$1
+
CMDNAME=`basename $0`
USERNAME=$2
+
ACCOUNTNAME=$1
# $3 is a dummy (will eventually become host-name)
+
USERNAME=$2
# $4 is a dummy (will eventually become "POP3" | "IMAP")
+
# $3 is a dummy (will eventually become host-name)
COUNT_NEW=$5
+
# $4 is a dummy (will eventually become "POP3" | "IMAP")
COUNT_TOTAL=$6
+
COUNT_NEW=$5
+
COUNT_TOTAL=$6
#------------------------------------------------------------------
+
 
#    set some variables
+
#------------------------------------------------------------------
#------------------------------------------------------------------
+
#    set some variables
LOGCMD="logger -t $CMDNAME"
+
#------------------------------------------------------------------
SVDRPSEND="/usr/local/bin/svdrpsend.pl"
+
LOGCMD="logger -t $CMDNAME"
+
SVDRPSEND="/usr/local/bin/svdrpsend.pl"
#------------------------------------------------------------------
+
 
#    log the parameters
+
#------------------------------------------------------------------
#------------------------------------------------------------------
+
#    log the parameters
$LOGCMD "========================================================"
+
#------------------------------------------------------------------
$LOGCMD "svdrpsend      : '$SVDRPSEND'"
+
$LOGCMD "========================================================"
$LOGCMD "AccountName    : '$ACCOUNTNAME'"
+
$LOGCMD "svdrpsend      : '$SVDRPSEND'"
$LOGCMD "UserName        : '$USERNAME'"
+
$LOGCMD "AccountName    : '$ACCOUNTNAME'"
$LOGCMD "New / Total    : $COUNT_NEW / $COUNT_TOTAL"
+
$LOGCMD "UserName        : '$USERNAME'"
$LOGCMD "========================================================"
+
$LOGCMD "New / Total    : $COUNT_NEW / $COUNT_TOTAL"
+
$LOGCMD "========================================================"
#------------------------------------------------------------------
+
 
#    send a message to vdr
+
#------------------------------------------------------------------
#------------------------------------------------------------------
+
#    send a message to vdr
EXTRET=0
+
#------------------------------------------------------------------
if test "$COUNT_NEW" -ne "0"; then
+
EXTRET=0
  $SVDRPSEND "MESG New mail in $ACCOUNTNAME";
+
if test "$COUNT_NEW" -ne "0"; then
  EXTRET=$?
+
  $SVDRPSEND "MESG New mail in $ACCOUNTNAME";
#else
+
  EXTRET=$?
#  $SVDRPSEND "MESG NO mail in $ACCOUNTNAME";
+
#else
fi
+
#  $SVDRPSEND "MESG NO mail in $ACCOUNTNAME";
+
fi
if test "$EXTRET" != "0"; then
+
 
  $LOGCMD "unable to execute $SVDRPSEND"
+
if test "$EXTRET" != "0"; then
  $LOGCMD "========================================================"
+
  $LOGCMD "unable to execute $SVDRPSEND"
fi
+
  $LOGCMD "========================================================"
+
fi
exit $EXTRET
+
 
 +
exit $EXTRET
 +
</pre>
  
 
[[Kategorie:Scripts]]
 
[[Kategorie:Scripts]]

Version vom 30. März 2005, 12:32 Uhr

#!/bin/sh
#
# mailcmd.sh
#
# source: vdr-plugin mailbox

#------------------------------------------------------------------
#     get params
#------------------------------------------------------------------
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

#------------------------------------------------------------------
#     set some variables
#------------------------------------------------------------------
LOGCMD="logger -t $CMDNAME"
SVDRPSEND="/usr/local/bin/svdrpsend.pl"

#------------------------------------------------------------------
#     log the parameters
#------------------------------------------------------------------
$LOGCMD "========================================================"
$LOGCMD "svdrpsend       : '$SVDRPSEND'"
$LOGCMD "AccountName     : '$ACCOUNTNAME'"
$LOGCMD "UserName        : '$USERNAME'"
$LOGCMD "New / Total     : $COUNT_NEW / $COUNT_TOTAL"
$LOGCMD "========================================================"

#------------------------------------------------------------------
#     send a message to vdr
#------------------------------------------------------------------
EXTRET=0
if test "$COUNT_NEW" -ne "0"; then
  $SVDRPSEND "MESG New mail in $ACCOUNTNAME";
  EXTRET=$?
#else
#  $SVDRPSEND "MESG NO mail in $ACCOUNTNAME";
fi

if test "$EXTRET" != "0"; then
  $LOGCMD "unable to execute $SVDRPSEND"
  $LOGCMD "========================================================"
fi

exit $EXTRET