Cron Job to send output to email in VMWare Virtual Appliance

Need help creating VMware script to simply run the command below and email the output.  This will be setup as a cron job to run daily.   Any assistance is appreciated.

VCSA:~ # df -h
Filesystem                            Size  Used Avail Use% Mounted on
/dev/sda3                              11G  6.4G  3.8G  63% /
udev                                   12G  164K   12G   1% /dev
tmpfs                                  12G   40K   12G   1% /dev/shm
/dev/sda1                             128M   38M   84M  31% /boot
/dev/mapper/core_vg-core               50G   13G   34G  28% /storage/core
/dev/mapper/log_vg-log                 25G  8.2G   16G  35% /storage/log
/dev/mapper/db_vg-db                   25G  977M   23G   5% /storage/db
/dev/mapper/dblog_vg-dblog            9.9G  712M  8.7G   8% /storage/dblog
/dev/mapper/seat_vg-seat               50G  5.4G   42G  12% /storage/seat
/dev/mapper/netdump_vg-netdump        9.9G  151M  9.2G   2% /storage/netdump
/dev/mapper/autodeploy_vg-autodeploy   25G  173M   24G   1% /storage/autodeploy
/dev/mapper/invsvc_vg-invsvc           25G  981M   23G   5% /storage/invsvc
Vincent TruongSr Server DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Take this step by step.

1) First make sure you can actually email from your source machine/container to your target recipient.

Keep in mind, if your recipient lives at a public Provider (Gmail, Hotmail, Yahoo, etc...) then use a relay service like MailGun to ensure your mail actually delivers.

Get your mail working before proceeding.

Hint: Many times feeding your command out output into SWAKS will be easiest way to send mail to a public Provider recipient.

2) Create your cron job, so say you'd like to check this every 4 hours...

0 */4 * * * df -h 2>&1 | swaks -tlsc -auth login -s $relay:587 -au $user -ap $pass --to=$recipient

Open in new window


Values for email delivery will vary depending on relay service you use.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Vincent TruongSr Server DeveloperAuthor Commented:
Thanks for the input.  We opted to utilize vCenter VM alerts for disks utilization which reflected in the system file for the VCSA.  I am going to keep this for future reference.
0
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Give MailGun a try for your relay service. First 10K messages/month are free with them, so for low volume applications, like what you just described... likely your monthly bill will be $0.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VMware

From novice to tech pro — start learning today.