Archive for June, 2009

nothing more today

Tuesday, June 23rd, 2009

It’s my vacation!!! I don’t have to work tomorrow… but I’m sure there will be more of my tips coming up, as I try not to write blog posts on the job….

VACATION

Shell Script to add a project to your local webserver

Friday, June 12th, 2009

Just finished a fun script, basically everytime I have to create a project on my apache2 localhost (debian based linux mint 64 ) I’ve had to copy over the scripts I use all the time, my normal layout etc.. well now I’ve developed my own rapid create tool.

I’ve built a shell script that prompts for the project name, then the project home folder and based on those answers creates the directory, creates an image dir, a scripts dir with subdirectories of php and js then copies those related scripts. After copying files it then creates a template index.html with calls to the copied scripts, and the touched stylesheet.

Once the script is done copying and creating files, it then adds the new address to my /etc/hosts file and creates an /etc/apache2/sites-available/host.rob file ( all my local addresses are .rob instead of .com ) and then makes the symbolic link to sites-enabled and finally restarts my webserver.

Here is the script

#!/bin/sh

tempp=”/var/www/template”

echo “Project Name:”
read pname

echo “Project Home Dir: (/var/www/) no spaces ”
read ppath

mkdir /var/www/$ppath
mkdir /var/www/$ppath/scripts
mkdir /var/www/$ppath/scripts/js
mkdir /var/www/$ppath/scripts/js/jquery
mkdir /var/www/$ppath/scripts/php
mkdir /var/www/$ppath/scripts/php/php_mailer
mkdir /var/www/$ppath/images
mkdir /var/www/$ppath/bak

cp $tempp/jquery.js /var/www/$ppath/scripts/js/jquery
cp $tempp/email.js /var/www/$ppath/scripts/js
cp -r $tempp/php_mailer/* /var/www/$ppath/scripts/php/php_mailer
cp $tempp/index.html /var/www/$ppath/
cp $tempp/styles.css /var/www/$ppath/
cp $tempp/sendmail.php /var/www/$ppath
cp $tempp/.htaccess /var/www/$ppath
cp $tempp/png-img.php /var/www/$ppath/scripts/php

echo “Root Password\a”
su -c “echo Running as root”

echo “127.0.1.1 $ppath.rob” | sudo tee -a /etc/hosts
echo “127.0.1.1 www.$ppath.rob” | sudo tee -a /etc/hosts

touch /etc/apache2/sites-available/$ppath.rob

echo “<VirtualHost *:80>” | sudo tee -a /etc/apache2/sites-available/$ppath.rob
echo ” ServerAdmin rob@robertsandusky.com” | sudo tee -a /etc/apache2/sites-available/$ppath.rob
echo ” ServerName $ppath.rob” | sudo tee -a /etc/apache2/sites-available/$ppath.rob
echo ” ServerAlias www.$ppath.rob” | sudo tee -a /etc/apache2/sites-available/$ppath.rob
echo ” DocumentRoot /var/www/$ppath” | sudo tee -a /etc/apache2/sites-available/$ppath.rob
echo “</VirtualHost>” | sudo tee -a /etc/apache2/sites-available/$ppath.rob

sudo ln -s /etc/apache2/sites-available/$ppath.rob /etc/apache2/sites-enabled/

sudo /etc/init.d/apache2 restart

echo “Project $pname has been created succesfully visit $ppath.rob to begin”

Switch from IE 6

Thursday, June 11th, 2009

Today I’m starting a new site, http://www.switchfromie6.com it’s dedicated to making a simple site that every one can link to and have everything explained about why to upgrade and how. We will be adding a javascript library file to provide everything necessary to shadow box your page and hover our upgrade notice.

Check switchfromie6.com soon to see what we’re talking about.