function.sh 899 Bytes
#!/bin/bash
################################################################
#@Authro Lijian
#@Date 2007-08-09
################################################################

PROJECT_TARGET=$2.zip
WEB_APP_HOME=$1/$2/deploy

#app install
install(){
	if [ -d $WEB_APP_HOME ]; then
		sh $WEB_APP_HOME/bin/killws.sh
		
		echo "[INFO] rm -rf $WEB_APP_HOME"
		rm -rf $WEB_APP_HOME
	fi

	echo "[INFO] mkdir $WEB_APP_HOME"
	mkdir $WEB_APP_HOME
	
	echo "[INFO] unzip -q $WEB_APP_HOME/../$PROJECT_TARGET -d $WEB_APP_HOME"
	unzip -q $WEB_APP_HOME/../$PROJECT_TARGET -d $WEB_APP_HOME
}

#app startup
startup(){
	sh $WEB_APP_HOME/bin/startws.sh
}

#app links
links(){
	echo "[INFO] ln -s ..."
	
	if [ -d $WEB_APP_HOME/htdocs ]; then
		ln -s /data/upload $WEB_APP_HOME/htdocs/upload
	fi
	
	#if [ -d $WEB_APP_HOME/htdocs ]; then
		#ln -s $WEB_APP_HOME/logs $WEB_APP_HOME/htdocs/logs
	#fi
}

install
startup
links