Archive | Linux

New to my .bashrc

alias GetExtIP=”wget -q -O –|sed -e ‘s/.*Current IP Address: //’ -e ‘s/<.*$//'”

Now I can know what my external IP is!!!

New MD5 based backup script

I found this use of md5 and find the other day. I based my current backup script around it. The md5 will show if anyone modifies a file, or adds/removes a file in the web hosting root (/var/www) or in the config directory (/etc/httpd/conf.d/). If there is a change then zip each site up individually and move to a backup folder to be rsynced to other servers.

NewWWWMD5=$(find /var/www/ -type f -exec md5sum {} \; | md5sum - | awk '{print $1}')
OldWWWMD5=$(cat $PARENTDIR/_var_www_*.md5)
NewConfMD5=$(find /etc/httpd/conf.d/ -type f -exec md5sum {} \; | md5sum - | awk '{print $1}')
OldConfMD5=$(cat $PARENTDIR/_etc_httpd_conf.d_*.md5)

if [ $NewWWWMD5 = $OldWWWMD5 -a $NewConfMD5 = $OldConfMD5 ]; then
	echo "Neither /var/www/ nor /etc/httpd/conf.d/ have changed"
	rm -rf $BACKUPDIR/*Files
	echo "/var/www or /etc/httpd/conf.d has changed"
	mkdir -p $BACKUPDIR-Files

	# backup /var/www
	for directory in /var/www/*; do
	  	if [ -d $directory ]; then
	    	bu $directory;

	# replace previous /var/www MD5
	rm -f $PARENTDIR/_var_www_*.md5
	find /var/www/ -type f -exec md5sum {} \; | md5sum - | awk '{print $1}' &gt; $PARENTDIR/_var_www_$CURRENTDAY.md5

	#backup /etc/httpd/conf.d
	bu "/etc/httpd/conf.d"

	# replace previous /etc/httpd/conf.d MD5
	rm -f $PARENTDIR/_etc_httpd_conf.d_*.md5
	find /etc/httpd/conf.d/ -type f -exec md5sum {} \; | md5sum - | awk '{print $1}' &gt; $PARENTDIR/_etc_httpd_conf.d_$CURRENTDAY.md5

Seems to work!

BASH (readline) keyboard shortcuts

I was just in training and the instructor was a command line keyboard shortcut wizard. He was magically making words disappear and reappear. So i fond this list of shortcuts. Many of them did not work in my OS X BASH prompt.I fond I had to go into the preferences and select “use option key as meta key” on the keyboard tab (it is at the bottom). Now I can add a few shortcuts to my repertoire.

Installing Flash on CentOS 5.4 x64

Here is what I tried:


tar -xzf

mv ~/.mozilla/plugins/

Visual Studio with VMware Fusion and SSH

I work on a Mac, but by day I am a windows guy. Even though I am not a developer, I often hack about using Visual Studio on the PC. Recently, have been working more and more with Linux, and I wanted to use Visual Studio on my Mac via VMware Fusion to edit some .css files on a linux slice that I have setup. I was looking for extension to Visual Studio to connect to a ssh/sftp site. Then it hit me (things would be a lot easier if I was smarter) – VMware Fusion installed the FUSE file system (optional) on my Mac. I can use the program MacFusion on my Mac to “mount” a ssh FUSE file system, and then add a VMware Fusion “Shared folder” to point to the mounted folder.

Now I can use Visual Studio to edit files on a Linux box!