#!/bin/sh # $Id: after-rec.sh 5 2008-02-25 00:01:44Z philipp $ # VDR after recording script: # Sends status mail after successful recording # Only handle action "after", saves some cpu cycles if [ $1 != "after" ] then exit 0 fi # Check for correct recording dir if [ -z "$2" ] then echo "Error: No recording dir" exit 1 fi # Modify Start MAIL_FROM=vdr@$(hostname) MAIL_TO=user@exmapleserver.com MAIL_SERVER=exampleserver.com # Modify End REC_TITLE_RAW=$(grep ^T "$2/info.vdr") REC_TITLE=${REC_TITLE_RAW#T } REC_SHORT_RAW=$(grep ^S "$2/info.vdr") REC_SHORT=${REC_SHORT_RAW#S } REC_PATH=$2 echo "After recording $2 (${REC_TITLE})" { echo "Date: $(date -R)" echo "From: VDR M740AV <${MAIL_FROM}>" echo "Subject: [M740AV] Aufzeichnung beendet (${REC_TITLE})" echo echo "Folgende Aufzeichung wurde erfolgreich beendet:" echo "Titel: ${REC_TITLE#T}" echo "Kurztext: ${REC_SHORT}" echo "Pfad: ${REC_PATH}" echo "Größe: $(du -h "${REC_PATH}" | cut -f 1)" echo echo "-------------------------------------------------------------------------------" echo "System Status: $(uptime)" echo "-------------------------------------------------------------------------------" echo echo "-------------------------------------------------------------------------------" echo "Memory Status:" echo "-------------------------------------------------------------------------------" free | head -n 2 echo "-------------------------------------------------------------------------------" echo echo "-------------------------------------------------------------------------------" echo "VDR Status:" echo "-------------------------------------------------------------------------------" tail -n 15 /var/log/messages echo "-------------------------------------------------------------------------------" } | mini_sendmail -s${MAIL_SERVER} ${MAIL_TO} exit 0