automation, monitoring, scripting, Uncategorized

How to send attachment from Linux

There are some cases when its needed to send via email many scripts output results from Linux command line.  Here is an working example to achieve this.

It is expected that email options have been already configured so that mail command is working.

Below is the example of command which will zip all related logs  from /tmp folder into a .zip file “”

zip -r /tmp/ /tmp/WLCs-peers-*.log.filtered

next command will send email with .zip attachment to

mpack -s “AVC and other data from WLCs” /tmp/

Mentioned commands can be executed from cron on a regular basis.