abbat/ydcmd

Enable Cron Email Alert on errors only

Closed this issue · 1 comments

Abbat,
My Crons are running properly.

However I only want them to send me an Email Alert if there was an Error in file "PUT".
can you help me write a sample .Sh script please ??

Something like this:

#!/bin/bash

OUT=$(ydcmd put ... 2>&1)
if [ "$?" -ne "0" ]; then
    echo "${OUT}"
fi

Set MAILTO in your crontab to send emails with error output.