make_vhost.sh

  • strict warning: Non-static method view::load() should not be called statically in /home/saturn/public_html/blog/sites/all/modules/views/views.module on line 906.
  • strict warning: Declaration of views_handler_filter::options_validate() should be compatible with views_handler::options_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter::options_submit() should be compatible with views_handler::options_submit($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/views_handler_filter.inc on line 607.
  • strict warning: Declaration of views_handler_filter_boolean_operator::value_validate() should be compatible with views_handler_filter::value_validate($form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/handlers/views_handler_filter_boolean_operator.inc on line 159.
  • strict warning: Declaration of views_plugin_style_default::options() should be compatible with views_object::options() in /home/saturn/public_html/blog/sites/all/modules/views/plugins/views_plugin_style_default.inc on line 24.
  • strict warning: Declaration of views_plugin_row::options_validate() should be compatible with views_plugin::options_validate(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.
  • strict warning: Declaration of views_plugin_row::options_submit() should be compatible with views_plugin::options_submit(&$form, &$form_state) in /home/saturn/public_html/blog/sites/all/modules/views/plugins/views_plugin_row.inc on line 134.

My original "make vhost" script for creating new virtual hosts on my web server at home.

#!/bin/bash
# Raoul's Make Virtual Host script
# Copyright (c) 2006-2009 Raoul Snyman
# Licensed under the GNU GPL v2.0

# Script variables
DOMAIN="lan"
WEBROOT="/home/www-data"
FWDZONE="/etc/bind/zones/lan.zone"
REVZONE="/etc/bind/zones/1.168.192.in-addr.arpa.zone"
SKELFILE="/etc/apache2/skel/skel.domain"
SITESDIR="/etc/apache2/sites-available"
WEBUSER="www-data"
WEBGROUP="www-data"
FWDIP="192.168.1.254"
REVIP="254"
DNSRELOAD="/etc/init.d/bind9 reload"
WEBRELOAD="/etc/init.d/apache2 reload"

# Make our directories
mkdir $WEBROOT/$1
mkdir $WEBROOT/$1/www
mkdir $WEBROOT/$1/logs
mkdir $WEBROOT/$1/cgi-bin
chown -R $WEBUSER:$WEBGROUP $WEBROOT/$1

# Copy the skeleton file and enable it
sed s/skel/$1/ $SKELFILE | sed s/domain/$DOMAIN/ > $SITESDIR/$1.$DOMAIN
a2ensite $1.$DOMAIN

# Create the entry in the forward zone file
echo ";" >> $FWDZONE
echo "; `date`" >> $FWDZONE
echo "$1   IN    A    $FWDIP" >> $FWDZONE

# Create the entry in the reverse zone file
echo ";" >> $REVZONE
echo "; `date`" >> $REVZONE
echo "$REVIP    IN    PTR    $1" >> $REVZONE

#Restart the services
$DNSRELOAD 
$WEBRELOAD