Lasso Soft Inc. > Home

  • Articles

Multiple Lasso 9 Sites

Simple tool for creating multiple Lasso 9 sites

This script automates the process of creating the Lasso 9 equivalent of a new Lasso Site

!/bin/bash


echo "----------------------------------------------------------------"
echo ""
echo "Lasso Site Creation Tool"
echo " - checkouts version of Lasso"
echo " - creates FastCFG server script"
echo " - creates apache conf file for site"
echo ""

sitepath=$1
sitename=$2
domain=$3
testport=$4
defaultsvn="-r 1188 http://download.lassosoft.com/svn/lasso/lasso9_beta/trunk"


while [ "$sitepath" = "" ]
do
	if [ $# -eq 0 ]; then
		echo -n "Lasso site path, eg. /Library/WebServer/LassoSite1 ? "
		read sitepath
	fi
done

while [ "$lassosvn" = "" ]
do
	echo -n "Lasso SVN URL, default: $defaultsvn ? "
	read lassosvn
	if [ "$lassosvn" = "" ]; then
		lassosvn="$defaultsvn"
	fi		
done

while [ "$sitename" = "" ]
do
	echo -n "Lasso site name, eg. LassoSite1 (no funky characters) ? "
	read sitename
done

while [ "$domain" = "" ]
do
	echo -n "Lasso site domain, eg. www.thedomain.com ? "
	read domain
done

while [ "$port" = "" ]
do
	while [ "$testport" = "" ]
	do
		
		ports=` lsof -i -P | grep lasso | grep LISTEN | sed 's/.*\*:\(.*\) .*$/	\1/' `
		echo ""
		echo "   Ports in use by Lasso:"
		echo "$ports"
		echo ""
		echo -n "Lasso site port, eg. 8998 ? "
		read testport
	
		
	done
		inuse=`lsof -i -P | grep ":$testport" |  sed 's/\([% 	]\).*$/\1/'`

		if [ "$inuse" != "" ]; then
			echo ""
			echo "   Port $testport already in use!!! ($inuse)"
			testport=""
		else
			port="$testport"
		fi


done

if [ $# -lt 5 ]; then
	conf="/etc/apache2/users/$sitename.conf"
fi

echo ""
echo "Lasso site path: $sitepath"
echo "Lasso site domain: $sitepath"
echo "Lasso site domain: $sitepath"
echo "----------------------------------------------------------------"
echo "Checking out Lasso $lassosvn to: $sitepath "
svn checkout $lassosvn $sitepath 

echo "----------------------------------------------------------------"
echo "Creating server script"


server="$sitepath/$sitename"


touch $server 
chown -R _www "$sitepath"
chmod +sx "$server"


echo "#!/bin/bash" > $server 
echo "BASE=\`basename \$0\`" >> $server
echo "export LASSOSERVER_FASTCGIPORT=$port" >> $server
echo "export LASSO9_HOME=\"$sitepath\"" >> $server 
echo "touch /tmp/lassoserver.\$BASE.log" >> $server
echo "chmod +rw /tmp/lassoserver.\$BASE.log" >> $server
echo "$sitepath/LassoExecutables/lassoserver 2>&1> /tmp/lassoserver.\$BASE.log " >> $server


echo "----------------------------------------------------------------"
echo -n "Creating apache conf: $conf "
sleep 1
echo -n "."
sleep 1
echo -n "."
sleep 1
echo -n ". "

echo "FastCGIServer $server" > $conf
echo "FastCgiExternalServer /$sitename -host localhost:$port -pass-header Authorization" >> $conf
echo "FastCgiExternalServer /LassoDirect$sitename -host localhost:$port -pass-header Authorization" >> $conf

echo "<VirtualHost *:80>"  >> $conf
echo "	ServerName $domain" >> $conf
echo "	DocumentRoot \"/Library/WebServer/Documents\" " >> $conf
echo "	ScriptAlias /lasso9 /$sitename " >> $conf
echo "	ScriptAlias /lasso9direct /LassoDirect$sitename " >> $conf
echo "	AddType application/x-httpd-lasso9 .lasso " >> $conf
echo "	Action application/x-httpd-lasso9 /lasso9direct " >> $conf
echo "</VirtualHost>" >> $conf

echo "done"
echo ""
echo -n "Restarting Apache (graceful)"
sleep 1
echo -n "."
sleep 1
echo -n "."
sleep 1
echo -n ". "
apachectl -k graceful
echo "done"
echo ""
echo "Finished

Author: Ke Carlton
Created: 25 Feb 2010
Last Modified: 16 Mar 2011

Comments

No comments found
You must be logged in to comment.

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft