This is actually more of a scripting thing, but what is a bash script except a collection of command lines....
To send a bit of text to /var/log/syslog:
logger Hello logging world!!
If you wish the output of a particular line in the script to be logged:
mysql -V | logger
will send the MySQL version to syslog. If you wish to also capture errors (STDERR) output, this will do it:
mysql < /path/to/a/sql/script.sql 2>&1 | logger
will send both script and error output to syslog.
You want the e-mail your mail server sends out delivered to an inbox, not to a SPAM folder. And certainly not bounced. Here are the simple things that you can do:
myhostname = hostname.domain.com
domain.com TXT "v=spf1 mx -all"says that a server should only accept e-mail for domain.com from a server with the same IP address as domain.com's MX record. This DNS record:
domain.com TXT "v=spf1 a -all"says that a server should only accept e-mail for domain.com from a server with the same IP address as domain.com's A record. This
domain.com TXT "v=spf1 mx a ip4:188.8.131.52 include:_spf.google.com -all"directs a server to accept e-mail from this domain from several sources, including Google's mail servers.
dig +short domain.com txtwill display domain.com's current TXT record(s).
port25.com provides an excellant facility for testing your setup. Send an e-mail from your e-mail server to email@example.com or firstname.lastname@example.org and they will send you an e-mail back showing your e-mail's hostname and SPF status, among other things.