simple.
---------------------------------------------
#!/bin/sh
function usage()
{
echo "db2mail <DBNAME> <MAILTO>"
exit 1
}
function cleanup()
{
rm -f $DUMP $OUTF || true
}
DB="$1"
MAILTO="$2"
[ -n "$MAILTO" ] || usage
DUMP=`tempfile -p $DB- -s .sql`
OUTF=`tempfile`
export DUMP OUTF
trap EXIT cleanup
mysqldump --opt $DB > $DUMP
mpack -s "Your database $DB" -o $OUTF $DUMP
cat $OUTF | dbmail-smtp -d $MAILTO -m Databases
---------------------------------------------
Nataraj S Narayan wrote:
> Hi
>
> I am having a Dbmail 2.0.9 + postfix setup.
> Want to write a cron script that tars a Mysql database and sends the tar
> as mail attachment to
> one particular user's mailbox.
>
> I have both Dbmail and the mysql database in the same machine. Plz help
> me with mail client program available for this in Postfix/dbmail. I find
> a program by name sendmail along with postfix. Does it have same syntax
> as the one packed with sendmail MTA?
>
> Or should I write a script in TCL,PHP or perl for this?
>
> regards
>
> Nataraj
>
>
> _______________________________________________
> DBmail mailing list
> [email protected]
> https://mailman.fastxs.nl/mailman/listinfo/dbmail
>
--
________________________________________________________________
Paul Stevens paul at nfg.nl
NET FACILITIES GROUP GPG/PGP: 1024D/11F8CD31
The Netherlands________________________________http://www.nfg.nl