I want to send to my e mail account a mail with log from program execution. This file changes everyday and it's named like this
log-20190703.gz
My attempt:
#!/bin/bash
log_file=logs-$(date +"%Y%m%d").gz
echo "Log file for project" | mailx -s "Log file for start_ux" -a /srv/python/myfold/proj/Log_UX/${log_file} myemail@gmail.com
that gives me an error:
log_file command not found
zless /srv/python/myfold/proj/Log_UX/log-20190703.gz
)? – Freddy Mar 07 '19 at 10:20(uuencode /srv/python/myfold/proj/Log_UX/${log_file} ${log_file}; echo "Log file for project") | mailx -s "Log file for start_ux" myemail@gmail.com
work? – Freddy Mar 07 '19 at 10:31mailx
on that Unix say the correct option for attachments is? "Account ... does not exist" sounds odd. On Linux it's usually-A
, BSD does not do attachments withmailx
, and I'm uncertain for AIX and Solaris. – Kusalananda Mar 07 '19 at 10:34log-20190703.gz
is the name of the logfile, but you are usinglogs-$(date +"%Y%m%d").gz
with an additional "s" in the script. – Freddy Mar 07 '19 at 10:37