I have a cron job that runs a script.sh file (Which takes the backup of DB), and sends me an email every hour. In script.sh file, I'm taking backup of few databases(.sql file), then creating .zip of that. My issue is, I want to get an email only if something goes wrong. Currently I'm getting the following Email every hour.
adding: db2017_173601.sql (deflated 89%)
adding: bvDatabase_173601.sql (deflated 94%)
adding: cmc_173601.sql (deflated 60%)
Any idea how to solve this? I'm using this code in my crontab:(-E option to prevent empty body in heirloom mailx)
/60 * * * * /usr/local/sbin/mysqldata.sh 2>&1 | mail -s "Backup Failed" -E email@example.com