I've written a script and everything is working so well according to my needs:
a=$(df -h /mnt/smb | tail -n +3 | tr -s ' ' | tr '%' ' ' | cut -d ' ' -f 5)
echo $a
if [[ $a -ge 30 ]]; then
cat /etc/diskspace/text.txt | sendmail test.gmail.com
fi
I want to run this script every minute via Cron, see my crontab:
* * * * * /etc/diskspacae/vpndrive.sh
As you can see, after running this script if drive space is more than 80%, I want to use sendmail to get a notification in my email.
But I haven't got it when I've run this script from Cron, and I've got this error message in /var/spool/mail/root.
ERROR Message: /etc/diskspace/vpndrive.sh line 34 : sendmail: command not found.