Script to mail output of select query

Script to mail output of select query

am 15.03.2011 10:08:11 von Adarsh Sharma

--------------090502050800030001060207
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Dear all,

I have prepared a simple script that shows the database, tables size in
the Database server as :-

Please check the attachment for the script & output.

Now I just want to mail the output of my script to some persons e-mail-ID

Also, I want to do some calculations and provide the information of how
much increase data after 1 day daily.


Please guide me how to do this.



Thanks & best Regards,

Adarsh Sharma

--------------090502050800030001060207
Content-Type: application/x-shellscript;
name="status.sh"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="status.sh"

ZWNobyAnMi4gSW5kaXZpZHVhbCBEYXRhYmFzZXMgU2l6ZSA6LScKCm15c3Fs IC1lIlNFTEVD
VCB0YWJsZV9zY2hlbWEgJ2RhdGFiYXNlJyxjb25jYXQoIHJvdW5kKCBzdW0o IGRhdGFfbGVu
Z3RoICsgaW5kZXhfbGVuZ3RoICkgLyAoIDEwMjQgKjEwMjQgKjEwMjQpICwg MiApICwgJ0cn
ICkgc2l6ZSBGUk9NIGluZm9ybWF0aW9uX3NjaGVtYS5UQUJMRVMgV0hFUkUg RU5HSU5FPSgn
TXlJU0FNJyB8fCAnSW5ub0RCJyApIEdST1VQIEJZIHRhYmxlX3NjaGVtYSI7 CgplY2hvICcz
LiBTdGF0dXMgb2YgVGFibGVzIG9mIGRhdGFfY29tcGFueSBkYXRhYmFzZSA6 LScKCm15c3Fs
IC1oMTkyLjE2OC4xLjEwNiAtdXJvb3QgLXBvcmthc2ggLWUiU0VMRUNUIHRh YmxlX3NjaGVt
YSAnZGF0YWJhc2UnLCB0YWJsZV9uYW1lICdUYWJsZScsCiAgICAgICBjb25j YXQocm91bmQo
KGRhdGFfbGVuZ3RoICsgaW5kZXhfbGVuZ3RoKSAvICgxMDI0KjEwMjQqMTAy NCksIDIpLCAn
RycgKSBzaXplR0IsCiAgICAgICBjb25jYXQocm91bmQoKGRhdGFfbGVuZ3Ro ICsgaW5kZXhf
b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gICAgICAg ICAgICAgICAg
J2NyYXdsZWQnLCAndXJsJywgJ3dlYnNpdGUnLCAnd2Vic2l0ZV9pbnQnLCAn bWFzdGVyJyki
OwoKCmVjaG8gYGRhdGVgCg==

--------------090502050800030001060207
Content-Type: text/plain; charset=us-ascii


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
--------------090502050800030001060207--

Re: Script to mail output of select query

am 15.03.2011 10:28:12 von Johan De Meersman

----- Original Message -----
> From: "Adarsh Sharma"
>
> Please check the attachment for the script & output.

Thanks for your password :-)

> Now I just want to mail the output of my script to some persons
> e-mail-ID

Assuming you run this from crontab, just set MAILTO=person@domain.ext right before the script execution line.

> Also, I want to do some calculations and provide the information of
> how much increase data after 1 day daily.

Uhh. Munin? Cacti? Output CSV-formatted data and append to a file, then process using a spreadsheet? Insert the data into a table in your DB and play with that? Plenty of ways to do that, all depends on what you want and need. The key is that you're going to have to keep historical data for that somewhere.

Strictly speaking, also not on topic here :-)


--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org