A
A
Andrey San2014-11-18 13:45:05
linux
Andrey San, 2014-11-18 13:45:05

Bash, how to mail result?

Good evening, how to send the result of the request by mail?
85357e417b4f42df8d1bc856487e8f3e.JPG
now it stores in the home directory

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel Shvedov, 2014-11-18
@mmmaaak

supposed to work

mysql -u root -pPAssword -E "zabbix" -e "select * from hosts;" | mail (...тут параметры утилиты mail, гугли или man mail в помощь)

V
Valentin, 2014-11-18
@nowfine

here is a working version
echo SQL DUMP `date +%D-%H:%M:%S` |mail -s "[sqldump]" -A /etc/passwd [email protected]
parameter -A - specifies the file that should be attachment.
and don't forget to gzip the sql code before sending

S
Sergey Petrikov, 2014-11-19
@RicoX

Choice:

metasend -b -s "$SUBJECT" -f $TXTFILE -m text/plain -e none -n -f $ATTFILE -m application/octet-stream -e base64 -t $MAILTO 
mpack -s "$SUBJECT" -c application/octet-stream $ATTFILE $MAILTO 
mutt -a $ATTFILE -s "$SUBJECT" $MAILTO < $TXTFILE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question