mysqldump --user=me --password=pass --no-create-db --no-create-info -w 'SUBSTR(myTimeStampField FROM 1 FOR 10) = SUBSTR(DATE_SUB(now(), INTERVAL 1 DAY) FROM 1 FOR 10)' myDatabase myTable | gpg --yes -e -a -o - -r me@myaddress.com | mailx -s "Entries in myDatabase.myTable for `date`" me@myaddress.com If you export your public key and copy it to the database server for encryption, you will need to sign it with that server's key. So, generate a key with 'gpg --gen-key' and then sign your public key with 'gpg --lsign me@myaddress' I was totally unable to get gpg on OS X or solaris to manually adjust the trust of my public key, so signing it was the only choice. It works. Now, I know this is just two pipes and single set of back-ticks but... if you knew how long it took to get gpg to use my public key, and to get it to work without asking me if I was sure, and to get mysqldump to take a where clause, and to get it to generate useful output for day - 1 after I happened to fix the timezone for that server, and to be sure it worked with the delay in mail delivery... You would pat me on the baxor. How to mysqldump a single table's entries for the previous day, encrypt them with GPG, and mail them home OR The longest shell command of my career |