Mysql lock, show master, backup, and unlock

#!/usr/bin/expect -f
#Created by Will 22 Mar 06
#
#this script is designed to log onto the mysql
#client, read lock tables, show master status,
#bounce out to the shell and dump databases
#to gzipped sql files, then unlock the tables.
#
#these files are then backed up using veritas
#over smb.
#
#

set force_conservative 0  ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn mysql -u root -p
match_max 100000
expect -exact "Enter password: "
send -- "password\r"
expect "mysql> "
send -- "FLUSH TABLES WITH READ LOCK;\r"
expect "mysql> "
send -- "show master status;\r"
expect "mysql> "

send -- "system mysqldump --add-locks -Fq -u root -ppassword -B mysql | gzip > /var/lib/mysqlbackup/mysql.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B tapemanagement | gzip > /var/lib/mysqlbackup/tapemanagement.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B DPMAIN | gzip > /var/lib/mysqlbackup/DPMAIN.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_ADVENTIST | gzip > /var/lib/mysqlbackup/CLIENT_ADVENTIST.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_AMC | gzip > /var/lib/mysqlbackup/CLIENT_AMC.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_ANG | gzip > /var/lib/mysqlbackup/CLIENT_ANG.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_BPA | gzip > /var/lib/mysqlbackup/CLIENT_BPA.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_CDS | gzip > /var/lib/mysqlbackup/CLIENT_CDS.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_CSA | gzip > /var/lib/mysqlbackup/CLIENT_CSA.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_EBS | gzip > /var/lib/mysqlbackup/CLIENT_EBS.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_MIDWEST | gzip > /var/lib/mysqlbackup/CLIENT_MIDWEST.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_REY | gzip > /var/lib/mysqlbackup/CLIENT_REY.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_ULTRAB | gzip > /var/lib/mysqlbackup/CLIENT_ULTRAB.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B DPAUTOTASK | gzip > /var/lib/mysqlbackup/DPAUTOTASK.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B DPGATEWAY | gzip > /var/lib/mysqlbackup/DPGATEWAY.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B DPREPORT | gzip > /var/lib/mysqlbackup/DPREPORT.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B Network_BEACON | gzip > /var/lib/mysqlbackup/Network_BEACON.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B Network_TRPN | gzip > /var/lib/mysqlbackup/Network_TRPN.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B WEBPROV | gzip > /var/lib/mysqlbackup/WEBPROV.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B DPMAIN_ARCHIVE | gzip > /var/lib/mysqlbackup/DPMAIN_ARCHIVE.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B DPAUTOTASK_ARCHIVE | gzip > /var/lib/mysqlbackup/DPAUTOTASK_ARCHIVE.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_OSG | gzip > /var/lib/mysqlbackup/CLIENT_OSG.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_TML | gzip > /var/lib/mysqlbackup/CLIENT_TML.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_MORRIS | gzip > /var/lib/mysqlbackup/CLIENT_MORRIS.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_CBA | gzip > /var/lib/mysqlbackup/CLIENT_CBA.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_CCMSI | gzip > /var/lib/mysqlbackup/CLIENT_CCMSI.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_TWN | gzip > /var/lib/mysqlbackup/CLIENT_TWN.sql.gz\r"
expect "mysql> "
send -- "system mysqldump --add-locks -Fq -u root -ppassword -B CLIENT_PRE | gzip > /var/lib/mysqlbackup/CLIENT_PRE.sql.gz\r"
expect "mysql> "

send -- "unlock tables;\r"
expect "mysql> "
send -- "quit\r"
expect eof

Speed up innodb imports

For a faster "mysqldump" innodb tables
1. mysqldump --opt --user=username --password database > filetosaveto.sql
2. open the dump file put this statement at the beginning of the sql dump text file:
SET AUTOCOMMIT = 0;
SET FOREIGN_KEY_CHECKS=0;
3. put this statement at the end of the sql dump text file:
SET AUTOCOMMIT = 1;
SET FOREIGN_KEY_CHECKS=1
4. mysql --user=username --password database

Work be suckin

Things are not looking good here at the old place of employment. It's been a pretty scary place to work for the last 5 or 6 months. We have lost, due to layoffs and moral, almost half of our employees from our peak level. I haven't been actively looking for a job seriously, but maybe I should. It's hard not to think about it at this point. Last time I wrote about work on here, a certain person printed out everything I said and gave it to the owner. I don't think I have to worry about that much longer the way things are going. Anyway... back to the grind...

Very Scary Video

Check out this video. It's of a RAF F-16 taking a bird strike just after takeoff. They make a turn towards an unpopulated area and then eject. Notice how calm the pilots are (2 seater F-16). I don't think I ever real seriously considered going down in a C-5 due to a bird strike. Maybe the ensuing fire and loss of systems due to the strike, but never the strike itself. Very interesting video.

Tuff Evening

Crash Photo's
So tonight I'm flying around SoCal in X-Plane, just playing in the mountains... In a 747 no less. I was just minding my own business when I got a fire warning light and the master caution started screaming at me. I had a fire in number one engine. The sim doesn't have fire handles or extinguishers but I still managed to get it shut down. I killed the start switch, batt, gen, fuel boost pump, and evenentially the throttle. The fire looked to go out, but there was still quite a bit of smoke from the engine. I declared an emergency. I didn't know the area very well and didn't have any of my charts out. ATC directed me to KPOC (Brackett Field Airport, La Verne). It's a halfway decent size run way. Lil' bit narrow, but still landable. I kicked on the autobreaks and spoilers, kicked out the flaps and gear and headed down. It was a straight in approach landing on 26L. I couldn't have made a prettier approach. Nearly a direct head wind I thought would give me a nice slow ground speed for touchdown. It wasn't so. It was VERY gusty even if it was right now the runway. I had to carry a bit more speed than I would have liked. This of course casued me to float long. With just barely 4800 feet of runway I didn't have much room to spare. I floated and finally touched down about 1/3 of the way down the runway, with nose gear finally coming down about 1/2 way down. I jammed on the binders and tried to stop. I probally should have dumped fuel on the way in but I didn't. I was pretty heavy. I didn't immediatly throw back the thrust reversers with an inop engine. That could be problems. I finally, about 3/4 down, decided to at least extend the TR's and about the time I went past the overrun and through the lights I went to full reverse. I finally did stop, about 10 or 15 foot from a rather large embankment. I'm sure that wouldn't have been very good on it. Anyway, here's some pics of the aftermath. Crash Photo's

P.S. Notice how far off center I drifted after using the reversers with an engine out.

I’m in LOVE!

If you have a little time and a little bandwidth, check out this ten minutes quicktime movie of C-5 crosswind landings in X-plane 7.61. It's incredible. Your watching it and forgetting that your looking at a game. It looks very realistic. I can't wait to see what it looks like in 8.40 on the ole iMac. This is the best C-5 I've ever even seen on a flight sim. Have I found things that are not quite correct, sure, but I'm anal like that. This movie is about ten minutes and just over 55MB's. http://x-plane.org/home/Caboclo/Galaxy/Present/Crosswind_320.mov

New Project

So I have very low moral at work now adaze, thus this is the result of that moral... I used to have this web site I went to in order to find airplane pics, wallpaper, and such. It was a page where every time you load it up it would display random pictures from Google. Well this site disappeared for a while and has been up and down a few times over the years, so I decided to write my own. I did something similar by pulling images from LiveJournal here http://www.williamhughes.net/ljimages.php. That is ok but not the greatest. I was able to get the original code of the page. That was in JavaScript. Since I'm not a whiz at JavaScript I decided to re-write it in php. Here's the code just in case anyone wants it. It's not quality code I know, but works none the less. Check it out and let me know what you think. Refresh the page for a whole new batch of pics. I'll probably tweak it a bit over the next week or two. BTW, this may display images that are not safe for work or children.

This was basically a pretty easy page.
1. Randomly choose a file naming convention format. This is different for each camera manufacture.
2. Create a giant case statement. Each case is a naming convention format.
3. In each case, randomly generate digits to format into a file name.
4. Copy that filename into a google search url.
5. Output html for a frame page and set the lower from to the google url.

*I tried to do an include to include the google html into my page. This didn't work because of the absolute paths in the google page.
*Many of the naming formats contained dates. Most of these are easy. Years were limited to 2004-2006. Months in many were hex vaules between 1 and C. A few had other options such as size. I choose large.
*There are many other settings and functions that I can add, but that will be a bit later. Maybe next time I get bored.

More Pics

I added some pics of my re-do of my garage. I added some industrial strength shelves along one wall. That got me a lot more vertical storage space. I haven't cleaned it up much yet but I did get a lot of things off the floor. I also made a work bench out of a 9 1/2 foot oak door and a bottom cabinet. I still need to find another bottom cabinet for the other side, but for now it's hooked up good enough to work.

Some stuff I found

We might be getting an iMac, soon, but that doesn't mean that we can't still laugh at it from time to time... I recently found some hidden treasures, apple parodies 1 & 2. Video Google has given me a lot, just Friday I had about 20 videos on it or so... Today, I have 63, all thanks to Video Google. Want iPod Hacks, you can find a bunch here. Think white earphones with a black iPod looks a little odd? Here's a tutorial showing you how to make those earphones black.