June 2009 Archives

Really gonna hurt

| No Comments

1231216239915.jpgI was looking over some files I had backed up from my last system rebuild and found this and realized I kept it for a reason. So here enjoy! Bah.

You can come out now

| No Comments

michaeljackondead.jpgWare just posted this to one of the irc channels i'm on and I just had to share it.

Jay Ware: So Farrah Fawcett died yesterday, and when she got to heaven the good lord said "I'll grant you one wish". Her wish, "all the children in the world to be safe", so god killed Michael Jackson.

;)

Current Mood:  amused

PuTTY Tray

| No Comments

Over the course of my usual wanderings about the web I found a nifty version of putty that works like portaPuTTY but has clickable URLs and minimizes to the tray.

PuTTY Tray
portaPuTTY

Cats playing

| No Comments

Apache proxying

| No Comments

Time for another installment of stupid linux tips and tricks. Tonight I will give you a fun recipe for website proxying that can be used to pass sites to a backend host or just outright proxy to a different network like I did when I was moving and neglected to update my DNS with the right timeouts.

Okay so first things first you will need some apache modules loaded.

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so

These are the basic proxy modules. You will also need the virtual host module for this next bit of fun and it is.

LoadModule vhost_alias_module modules/mod_vhost_alias.so

Okay so now we have all the modules loaded. Onto the config! Apache must have a virtual host named before it will recognize any of the virtual host configs. Ubuntu and suse, I think, have a host already setup so this is the line you are looking for.

NameVirtualHost *:80 or NameVirtualHost *

The next part is purely preference but you will need to make your virtual hosts. I like to keep mine near their content so if I have a website at /home/website/www i'll put the config at /home/website/website.conf and then I would put an include at the bottom of my httpd.conf like include /home/website/website.conf. Whichever virtual host loads first will be the default website that answers anytime someone hits the IP instead of a name. You can also put them in your conf.d directory or if you are on ubuntu under enabled-sites.

<VirtualHost *:80>
Servername wilpig.org
ServerAlias www.wilpig.org
ServerAlias *.wilpig.com

ProxyPass / http://<destination ip>/
ProxyPassReverse / http://<destination ip>/

CustomLog /home/wilbur/logs/wilpig.org/access_log combined
ErrorLog /home/wilbur/logs/wilpig.org/error_log

</VirtualHost>

Alright here is an example so I will explain the bits and pieces. First you have to have the server name and you will want to specify any alternate names that you might want to use with this site as well. So my default site is wilpig.org and then I gave it the aliases of www.wilpig.org and *.wilpig.org. The *.wilpig.org is a catch all so I can point any ole name at it and it will resolve back to my main site. Next you have the proxy commands. They are relatively simple which instruct the server on how to rewrite the links to pull the content up correctly. Finally we have the log directives. I'm sure you are asking yourself why the heck I would log my proxy traffic and the simple answer is the webserver will show all the traffic as coming from the proxy instead of the real clients which makes the logs almost useless.

You can do some funny things with this setup like use a host name instead of an IP. I setup a few hosts for my change over in the hosts table. The proxy for my server move was set as http://wilpig.org/ and the server looked at the host table for the IP instead of me specifying it. By setting it up with the host name you can proxy a site to another virtual site if needed.

And that concludes this next installment of my stupid linux tricks.

I was seen

| No Comments

Damnit it was bound to happen. I was seen on one of my trips to work on the house. This time I was betrayed by my desire for curry and pad thai. Do not try to blame anything on me you piece of shit I don't even own nor pocess a laptap.

Current Mood:  annoyed
Current Music:  Black Label Society - Suicide Messiah

Nursing

| No Comments

Nursing.jpgOkay I have no idea what the original source for this and I am admitting now I just ripped it out of some forum post. I laughed pretty hard so if someone knows the original source I would love to credit it.

Current Mood:  tired

Name that spider

| No Comments

creepy crawlie in the tub

Photo_060909_001.jpg

Slurpee

| No Comments

what trip to va is complete without a slurpee?

Photo_060809_001.jpg

Current Music:  Papa Roach - Scars

It's officially over

| No Comments

I've been telling myself something was wrong for the last few days as the excuses started piling up but I knew what it was. Someone wanna loan me a body to drive and $300 for gas?

Current Mood:  depressed

Frustration

| 1 Comment

Ever just have one of those conversations and at the end you have no idea what the hell happened? I just had another one of those and I still have no idea what in the world is going on.

Current Mood:  frustrated

Useful linux scripts

| No Comments

Over the next few weeks I am going to release some code snippets of stuff I have been using the for the past few years to automate some tasks under linux. Some of it will be simple like the one tonight for making backups of a MySQL server and keeping only X amount of the files on hand to later on I have a very nifty firewall script that has examples of 1:1 nat + vlan routing / blocking + multiple external IP management. Anyhow on with the goods.

MySQL.dump

#!/bin/bash
#
# /etc/cron.daily/MySQL.dump
# Script to dump the mysql tables daily for quick backups
# then it will rename the file to the format:
# database.sql-YYYY-MM-DD.HH:MM
#

b=`date +%F.%R`

for i in `echo "show databases" | mysql --user=backup --password=backuppassword | grep -v Database`; do
mysqldump --opt -ubackup -pbackuppassword $i > /home/sql.dmp/$i.sql;
mv /home/sql.dmp/$i.sql /home/sql.dmp/$i.sql-$b;
cp /home/sql.dmp/$i.sql-$b /backup/sql.dmp;
done

#Clean up files older than 1 week
find /home/sql.dmp/ -name "*" -mtime +8 -delete


Okay so what this is doing is logging into the local mysql server as the user backup and the password is backuppassword. I have set this user up in advance and has these global privileges "SELECT, FILE, SHOW DATABASES, LOCK TABLES". Clearly that password is in plaintext so make sure that user can only logon from localhost and this script is locked down as 500 so you don't have any prying eyes.

This here is the the start of the loop that logs in and creates a list of the databases on the server.
`echo "show databases" | mysql --user=backup --password=backuppassword | grep -v Database`

Next is the actual dump of the database to /home/sql.dmp/<databasename.sql>
mysqldump --opt -ubackup -pbackuppassword $i > /home/sql.dmp/$i.sql;

Next we are renaming the dump to add the date and time onto the end.
mv /home/sql.dmp/$i.sql /home/sql.dmp/$i.sql-$b;

This here is where I had a secondary directory setup for making copies of the dumps.
cp /home/sql.dmp/$i.sql-$b /backup/sql.dmp;

That is all there is to the actual backups of the databases. If you ever need to recreate a database just import the file and it should create all the tables and then repopulate the data. The last line of the script are for trimming out the older files so you don't just keep chewing up disk space. This here is a find command run on the directory that I am backing up to /home/sql.dmp and any file that is older than 8 days it deletes.

find /home/sql.dmp/ -name "*" -mtime +8 -delete

I suggest you compress these and move them off to some other location in case you have a drive die but this will make for quick database restores in the event of catastrophe.

Current Mood:  helpful

Depressed again

| 1 Comment

Seems like no matter what I try to do I keep just fucking it up more and more. The moral of the story is never help someone out that just can't seem to get it done on their own. My house in Murray is pretty thrashed due to letting people stay there that just didn't care to take care of it because it wasn't theirs. This is nothing new with me, everyone I have let stay with me because I thought they needed a little help has ended up fucking me over either by destroying something or monetarily. In some of the cases both ways! Yay!

In other news i've been down this road before and looks like changes are on the horizon on more than just the new job front. So tired of trying to make things work and be nice just to be told that I still can't get do anything right. Sometimes it really isn't worth getting out of bed. Speaking of bed I am back to my sleeping maybe 4 hours a day some days less. Since I am working midnight to noon now my schedule is a little weird to begin anyway.

Might as well stop the diarrhea of the mouth now and get back to watching stuff here at work.

Current Mood:  depressed

Love this ad

| No Comments

Sara posted this over on her site and I was kinda bored so I figured i'd give it a go. I've seen way too many bad movies.

Semi-Live Cam

February 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28            

Archives

WoW

Powered by Movable Type 4.25