Create an Account
username: password:
 
  MemeStreams Logo

MemeStreams Discussion

search


This page contains all of the posts and discussion on MemeStreams referencing the following web page: 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. You can find discussions on MemeStreams as you surf the web, even if you aren't a MemeStreams member, using the Threads Bookmarklet.

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
by Lost at 6:39 am EST, Mar 6, 2007

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.


 
 
Powered By Industrial Memetics