Mailcmd.sh

Aus VDR Wiki
(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(M)
 
(18 dazwischenliegende Versionen von 11 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
#!/bin/sh
+
Skript vom [[mailbox-plugin]], wurde ein wenig ''erweitert''.
#
+
# mailcmd.sh - v.0.1
+
#
+
# source: [[mailbox-plugin]]
+
+
#------------------------------------------------------------------
+
#    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
+
  
[[Kategorie:Scripts]]
+
Für '''"Sie haben Post..."''', geht es in etwa so.
 +
 
 +
shell> wget -P /mp3 http://www.mailhilfe.de/Download/emailp.wav
 +
shell> lame /mp3/emailp.wav
 +
shell> mv /mp3/emailp.wav.mp3 /mp3/emailp.mp3
 +
 
 +
Über [[Mp3-plugin#SVDRP Befehle]] '''PLAY''' können nur Sachen abgespielt werden, welche den '''PATH''' in der [[mp3sources.conf]] entsprechen!
 +
 
 +
{{Box Datei | [[Struktur|$PATH]]/mailcmd.sh |
 +
<pre>
 +
#!/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"
 +
  SOUNDFILE="/mp3/emailp.mp3"  # need mp3-plugin >= 0.9.15
 +
# 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##*/} "===================================="
 +
    screen -dm sh -c " \
 +
c=0 ; \
 +
until [ \$c -eq \${INTERVAL:-1} ] ; do \
 +
    svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"New m@il in"" $1 ...\" ; \
 +
    c=\$((c+1)) ; \
 +
    sleep 1s ; \
 +
done ; \
 +
if [ -e \"$SOUNDFILE\" ] ; then \
 +
    svdrpsend.pl -p ${VDR_PORT:-2001} PLUG mp3 PLAY \"$SOUNDFILE\" ; \
 +
fi
 +
    "
 +
fi
 +
</pre>
 +
}}
 +
 
 +
[[Kategorie:Skripte]]

Aktuelle Version vom 12. Juni 2006, 09:04 Uhr

Skript vom mailbox-plugin, wurde ein wenig erweitert.

Für "Sie haben Post...", geht es in etwa so.

shell> wget -P /mp3 http://www.mailhilfe.de/Download/emailp.wav
shell> lame /mp3/emailp.wav
shell> mv /mp3/emailp.wav.mp3 /mp3/emailp.mp3

Über Mp3-plugin#SVDRP Befehle PLAY können nur Sachen abgespielt werden, welche den PATH in der mp3sources.conf entsprechen!

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"
  SOUNDFILE="/mp3/emailp.mp3"  # need mp3-plugin >= 0.9.15
# 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##*/} "===================================="
    screen -dm sh -c " \
	c=0 ; \
	until [ \$c -eq \${INTERVAL:-1} ] ; do \
	    svdrpsend.pl -p ${VDR_PORT:-2001} MESG \""$"New m@il in"" $1 ...\" ; \
	    c=\$((c+1)) ; \
	    sleep 1s ; \
	done ; \
	if [ -e \"$SOUNDFILE\" ] ; then \
	    svdrpsend.pl -p ${VDR_PORT:-2001} PLUG mp3 PLAY \"$SOUNDFILE\" ; \
	fi
    "
fi