Mailcmd.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 18: Zeile 18:
 
# CONFIG START
 
# CONFIG START
 
   INTERVAL="3"
 
   INTERVAL="3"
 +
  METHOD="0"  # '0'=mesg / '1'=play ( need mp3-plugin >= 0.9.15 )
 +
  SOUNDFILE="/mp3/emailp.mp3"
 
# CONFIG END
 
# CONFIG END
  
 
if [ "$5" -ne 0 -a "$5" -ne -1 ] ; then
 
if [ "$5" -ne 0 -a "$5" -ne -1 ] ; then
     logit $0 "===================================="
+
     logger -t ${0##*/} "===================================="
     logit $0 "AccountName : $1"
+
     logger -t ${0##*/} "AccountName : $1"
     logit $0 "UserName    : $2"
+
     logger -t ${0##*/} "UserName    : $2"
     logit $0 "New / Total : $5 / $6"
+
     logger -t ${0##*/} "New / Total : $5 / $6"
     logit $0 "===================================="
+
     logger -t ${0##*/} "===================================="
 
     c=0
 
     c=0
 
     until [ $c -eq ${INTERVAL:-1} ] ; do
 
     until [ $c -eq ${INTERVAL:-1} ] ; do
svdrpsend.pl -p ${VDR_PORT:-2001} MESG ""$"New m@il in"" $1 ..."
+
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))
 
c=$((c+1))
sleep 1s
+
sleep 3s
 
     done
 
     done
 
fi
 
fi

Version vom 4. April 2006, 17:49 Uhr

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="3"
  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 $?