mailx in cron using variable date

I am using a popular HOSTUMP script that dumps successfully to a log file named

servername_a_`date +%m%d%y`.log

I then want to kick off a second cron job that will email me that log. I am assuming it has to be something like

00 07 * * 2 mailx -s 'SERVERNAME Tape A Weekly Backup Log' whomever@somewhere.com <! `cat /vol4/admin/logs/servername
_a_`date +%m%d%y`.log`

I am pretty new to this (obviously) Can anyone provide a little guidance? Maybe it is just easier to do this in the script itself? Thanks!

If the log file is created at the same time every day, you can setup a cron to mail the results to you.

Or You can add a line to the HOSTUMP script at the end to mail the file to you when it executes. If the file is created at different times of the day or odd increments.

Here is a link to a very good script to add attachments to mail messages. Not mine but very good script for attachments in UNIX.

:slight_smile: