Victor G. Brusca
SOFTWARE DEVELOPER
SYSTEM ADMINISTRATOR
DATABASE ADMINISTRATOR

Contact

XXX.XXX.XXXX

XX XXX XX.

XXX. XX
XXXXXX XX, XXXXX

vacuous_b@yahoo.com

 


Server Configuration Scripts

Main bash shell script, handles prompting for each task (if enabled), detection of CentOS or Ubuntu Linux, installation of all supporting software via package managers, calling subsequent PERL based config scripts for prepping Phinx, Composer, and PHP application config files.
** Important server names, IP addresses, and passwords have been remitted and replaced with a [redacted] tag.

#!/bin/bash

#Moodle admin | username:[redacted]		password:[redacted]
#PostgreSQL   | username:[redacted]		password:[redacted]
#PostgreSQL   | username:[redacted]		password:[redacted]

#POSTGRESQL VARS
PGADMINUSER="[redacted]"
PGADMINPASS="[redacted]"
PGDEVUSER="[redacted]"
PGDEVPASS="[redacted]"
PGSLINQDB="[redacted]"
PGMOODLEDB="[redacted]"
PGSELFSERVICEDB="[redacted]"
PGHOST="localhost"
PGPORT="5432"

#LOCAL VARS
D1="/home/ubuntu/files/shell_docs/xampp"                    #XAMPP installer dir
D2="/home/ubuntu/files/shell_docs/inqits_core"              #inqits core directory, clone from GIT
D3="/home/ubuntu/files/shell_docs/baks"                     #config file backup dir
D4="/home/ubuntu/files/shell_docs/scratch"                  #temporary dir for processing config files
D5="/home/ubuntu/files/shell_docs/composer"                 #composer bin dir
#D6="./moodle"                  			    			#moodle installer dir
D7="/home/ubuntu/files/shell_docs/inqits_moodle"            #inqits moodle, clone from GIT
D8="/home/ubuntu/files/shell_docs/inqits_selfservice"       #inqits self service, clone from GIT
D9="/home/ubuntu/files/shell_docs/inqits_activityRepo"      #inqits activity repo, clone from GIT
D10="/home/ubuntu/files/shell_docs/inqits_reports"	    	#inqits report repo, clone from git

PHPD="/opt/lampp/bin/php"       			    				#php source path
COMPD="/home/ubuntu/files/shell_docs/composer/composer.phar"    #composer source path

F1="xampp-linux-x64-5.5.28-0-installer.run"                     #XAMPP default installer
F2="bitnami-moodle-2.9.2-0-module-linux-x64-installer.run"      #moodle default installer
F3="composer.phar"                                              #composer binary file
F1D="$F1.done"
F2D="$F2.done"
FTMP1="download"                								#XAMPP download file name

#MOODLE DOWNLOAD FILENAME
FTMP2="bitnami-moodle-2.9.2-0-module-linux-x64-installer.run?bypassauth=false&fb=1&with_popup_skip_signin=1"

XAMPP_HOME="/opt/lampp"                 #XAMPP home directory
XAMPP_START="/opt/lampp/lampp"          #XAMPP service program, start/stop services
MYSQL_DAEMON="/opt/lampp/lampp"         #MySQL service program, start/stop services
PROFTP_DAEMON="/opt/lampp/lampp"        #ProFTP service program, start/stop services
APACHE_DAEMON="/opt/lampp/lampp"        #Apache service program, start/stop services

PHP_BIN="/opt/lampp/bin/php"
PHINX_BAT="/home/ubuntu/files/shell_docs/inqits_core/vendor/robmorgan/phinx/bin/phinx"
PHINX_CFG="/home/ubuntu/files/shell_docs/inqits_core/config/phinx.yml"
PHINX_SS_BAT="/home/ubuntu/files/shell_docs/inqits_selfservice/vendor/robmorgan/phinx/bin/phinx"
PHINX_SS_CFG="/home/ubuntu/files/shell_docs/inqits_selfservice/phinx.yml"

#PERL SCRIPTS
PREP_APACHE="./prep_apache"             #Apache configuration file PERL script
PREP_PHP="./prep_php"                   #PHP configuration file PERL script
PREP_PHINX_CONFIG="./prep_phinx_config"
PREP_SS_PHINX_CONFIG="./prep_selfservice_phinx_config"
PREP_PHINX_BAT="./prep_phinx_bat"
PREP_INQITS_CONFIG="./prep_inqits_config";
PREP_MOODLE_CONFIG="./prep_moodle_config";

#GIT VARS
GU="[redacted]"
GP="[redacted]"
GE="[redacted]"
GN="[redacted]"
GURL1="Apprendis/InqITS.git"
GURL2="Apprendis/Moodle.git"
GURL3="Apprendis/SelfService.git"
GURL4="Apprendis/ActivityRepo.git"
GURL5="Apprendis/Reports.git"

#INTERACTIVE VARS
ARG_INTACTV="false"
ARG_DBBACKUP="false"
ARG_INSTALL="false"
ARG_UPDATE="false"
ARG_HELP="false"
ARG_YUM="false"
ARG_LOCATE="false"
ARG_PROD="false"
ARG_PG_CLIENT="false"
RESULT="n"
STEP=0
JOB=-1
JOBFLAG=0

function checkDir {
	echo "Checking directory: $1"
	if [ ! -d "$1" ]; then
		return 0
	fi
	return 1
}

for var in "$@"
do
	if [ $JOBFLAG == 1 ]; then
		JOB=$var
		JOBFLAG=0
	else
		if [ $var == "-int" ]; then
			ARG_INTACTV="true"
		fi

		if [ $var == "-dbb" ]; then
			ARG_DBBACKUP="true"
		fi

		if [ $var == "-i" ]; then
			ARG_INSTALL="true"
		fi

		if [ $var == "-u" ]; then
			ARG_UPDATE="true"
		fi

		if [ $var == "-j" ]; then
			JOBFLAG=1
		fi

		if [ $var == "-y" ]; then
			ARG_YUM="true"
		fi

		if [ $var == "-a" ]; then
			ARG_YUM="false"
		fi

		if [ $var == "-h" ] || [ $var == "-help" ]; then
			ARG_HELP="true"
		fi

		if [ $var == "-l" ]; then
			ARG_LOCATE="true"
		fi

		if [ $var == "-p" ]; then
			ARG_PROD="true"
		fi

		if [ $var == "-pgc" ]; then
			ARG_PG_CLIENT="true"
		fi
	fi
done


#REPORT ARGS
echo "Interactive: ${ARG_INTACTV}"
echo "Install: ${ARG_INSTALL}"
echo "Update: ${ARG_UPDATE}"
echo "DB Backup: ${ARG_DBBACKUP}"
echo "Help: ${ARG_HELP}"
echo "Job: ${JOB}"
echo "Locate: ${ARG_LOCATE}"
echo "Prod: ${ARG_PROD}"
echo "Yum: ${ARG_YUM}"


if [ $ARG_PG_CLIENT == "true" ]; then
	if [ $ARG_YUM == "true" ]; then
		sudo yum install postgresql94-client
	else
		sudo apt-get install postgresql-client-9.4
	fi
fi


if [ $ARG_LOCATE == "true" ]; then
	if [ $ARG_YUM == "true" ]; then
		sudo yum install mlocate
		sudo updatedb
	else
		sudo apt-get instal mlocate
		sudo updatedb
	fi
fi


if [ $ARG_HELP == "true" ]; then
	echo "[USAGE: ./install_inqits [-i: install (action)] [-u: update (action)] [-dbb: database backup (action)] [-int: interactive mode] [-j #: run a specific job for action] [-l install mlocate] [-p CentOS production mode - otherwise Ubuntu mode] [-pgc PostgreSQL client install]"
fi


#RUN DB BACKUPS
if [ $ARG_DBBACKUP == "true" ]; then
	STEP=1
	#1: BACKUP SLINQ DB
	if [ $JOB == 1 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run ${PGSLINQDB} backup?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
		else
			RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
                        echo "${PGADMINPASS}\r\n"
                        sudo pg_dump -U ${PGADMINUSER} -h ${PGHOST} -W -d ${PGSLINQDB} -f ./baks/rut1_${PGSLINQDB}_db.sql -p ${PGPORT}
                        sudo tar -zcvf ./baks/rut1_${PGSLINQDB}_db.tar.gz ./baks/rut1_${PGSLINQDB}_db.sql

                        DT=`date +%Y%m%d_%H%M%s`
                        echo $DT

                        TRG="./baks/rut1_${PGSLINQDB}_db_${DT}.tar.gz"
                        sudo mv ./baks/rut1_${PGSLINQDB}_db.tar.gz $TRG
                        sudo rm ./baks/rut1_${PGSLINQDB}_db.sql
		fi
	fi


	((STEP++))
	#2: BACKUP MOODLE DB
	if [ $JOB == 2 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run ${PGMOODLEDB} backup?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
                fi

		if [ $RESULT == "Y" ]; then
                        echo "${PGADMINPASS}\r\n"
                        sudo pg_dump -U ${PGADMINUSER} -h ${PGHOST} -W -d ${PGMOODLEDB} -f ./baks/rut1_${PGMOODLEDB}_db.sql -p ${PGPORT}
                        sudo tar -zcvf ./baks/rut1_${PGMOODLEDB}_db.tar.gz ./baks/rut1_${PGMOODLEDB}_db.sql

                        DT=`date +%Y%m%d_%H%M%s`
                        echo $DT

                        TRG="./baks/rut1_${PGMOODLEDB}_db_${DT}.tar.gz"
                        sudo mv ./baks/rut1_${PGMOODLEDB}_db.tar.gz $TRG
                        sudo rm ./baks/rut1_${PGMOODLEDB}_db.sql
		fi
	fi


	((STEP++))
	#3: BACKUP SELF SERVICE DB
	if [ $JOB == 3 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
					echo "${STEP}: Run ${PGSELFSERVICEDB} backup?(y=yes, n=no, e=exit)"
					read RESULT
					if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
							RESULT="N"
					elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
							exit
					else
							RESULT="Y"
					fi
			else
					RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
					echo "${PGADMINPASS}\r\n"
					sudo pg_dump -U ${PGADMINUSER} -h ${PGHOST} -W -d ${PGSELFSERVICEDB} -f ./baks/rut1_${PGSELFSERVICEDB}_db.sql -p ${PGPORT}
					sudo tar -zcvf ./baks/rut1_${PGSELFSERVICEDB}_db.tar.gz ./baks/rut1_${PGSELFSERVICEDB}_db.sql

					DT=`date +%Y%m%d_%H%M%s`
					echo $DT

					TRG="./baks/rut1_${PGSELFSERVICEDB}_db_${DT}.tar.gz"
					sudo mv ./baks/rut1_${PGSELFSERVICEDB}_db.tar.gz $TRG
					sudo rm ./baks/rut1_${PGSELFSERVICEDB}_db.sql
			fi
	fi
fi


#RUN UBUNTU/CODE UPDATES
if [ $ARG_UPDATE == "true" ]; then
	STEP=1
	#1: UPDATE UBUNTU
	if [ $JOB == 1 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run package updates?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo "Updating the system..."
			if [ $ARG_YUM == "true" ]; then
				sudo yum update
			else
				sudo apt-get update
				sudo apt-get upgrade
				sudo apt-get dist-upgrade
			fi
		fi
	fi


	((STEP++))
	#2: RUN GIT UPDATE
	if [ $JOB == 2 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git update for (${D2})?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Updating ${D2}..."
			if [ -e "$D2" ]; then
				cd $D2
				git pull
				cd ../
			fi
		fi
	fi


	((STEP++))
	#3: RUN GIT UPDATE
	if [ $JOB == 3 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git update for (${D7})?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Updating ${D7}..."
			if [ -e "$D7"  ]; then
				cd $D7
				git pull
				cd ../
			fi
		fi
	fi


	((STEP++))
	#4: RUN GIT UPDATE
	if [ $JOB == 4 ] || [ $JOB == -1 ]; then	
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git update for (${D8})?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Updating ${D8}..."
			if [ -e "$D8" ]; then
				cd $D8
				git pull
				cd ../
			fi
		fi
	fi


	((STEP++))
	#5: RUN GIT UPDATE
	if [ $JOB == 5 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git update for (${D9})?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Updating ${D9}..."
			if [ -e "$D9" ]; then
				cd $D9
				git pull
				cd ../
			fi
		fi
	fi


	((STEP++))
	#6: RUN GIT UPDATE
	if [ $JOB == 6 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
					echo "${STEP}: Run Git update for (${D10})?(y=yes, n=no, e=exit)"
					read RESULT
					if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
							RESULT="N"
					elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
							exit
					else
							RESULT="Y"
					fi
			else
					RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
					echo ""
					echo ""
					echo "Updating ${D10}..."
					if [ -e "$D10" ]; then
							cd $D10
							git pull
							cd ../
					fi
			fi
	fi


	((STEP++))
	#7: RUN COMPOSER UPDATE
	if [ $JOB == 7 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run composer update?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Updating PHP dependencies with composer..."
			cd $D2
			pwd
			sudo $PHPD $COMPD install
			sudo $PHPD $COMPD update
			cd ../

			cd $D8
			pwd
			sudo $PHPD $COMPD install
			sudo $PHPD $COMPD update
			cd ../
		fi
	fi


	((STEP++))
	#8: UPDATE FILE SYSTEM DB
	if [ $JOB == 8 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run update file system db?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Update file db..."
			sudo updatedb
		fi
	fi


	((STEP++))
	#9: RUN DB MIGRATION
	if [ $JOB == 9 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
					echo "${STEP}: Run phynx db migration?(y=yes, n=no, e=exit)"
					read RESULT
					if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
							RESULT="N"
					elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
							exit
					else
							RESULT="Y"
					fi
			else
					RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
				echo ""
				echo ""
				echo "Running migration..."
				echo "${PHINX_BAT} migrate -c ${PHINX_CFG}"
				sudo chmod +x $PHINX_BAT
				sudo ${PHINX_BAT} migrate -c ${PHINX_CFG} -v

				echo "${PHINX_SS_BAT} migrate -c ${PHINX_SS_CFG}"
				sudo chmod +x $PHINX_SS_BAT
				sudo ${PHINX_SS_BAT} migrate -c ${PHINX_SS_CFG} -v
			fi
	fi
fi


#MAIN INSTALL SCRIPT
if [ $ARG_INSTALL == "true" ]; then
	STEP=1
	#1: CREATE DIRECTORIES
	if [ $JOB == 1 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run directory checks?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Checking save directory: $D1"
			if [ ! -d "$D1" ]; then
				mkdir "$D1"
				echo "Creating directory: $D1"
			else
				echo "Directory exists."
			fi

			checkDir $D2
			if [ $? == 0 ]; then
				mkdir "$D2"
				echo "Creating directory: $D2"
			else
				echo "Directory exists."
			fi

			checkDir $D3
			if [ $? == 0 ]; then
				mkdir "$D3"
				echo "Creating directory: $D3"
			else
				echo "Directory exists."
			fi

			checkDir $D4
			if [ $? == 0 ]; then
				mkdir "$D4"
				echo "Creating directory: $D4"
			else
				echo "Directory exists."
			fi

			checkDir $D5
			if [ $? == 0 ]; then
				mkdir "$D5"
				echo "Creating directory: $D5"
			else
				echo "Directory exists."
			fi

			#checkDir $D6
			#if [ $? == 0 ]; then
			#        mkdir "$D6"
			#        echo "Creating directory: $D6"
			#else
			#        echo "Directory exists."
			#fi

			checkDir $D7
			if [ $? == 0 ]; then
				mkdir "$D7"
				echo "Creating directory: $D7"
			else
				echo "Directory exists."
			fi

			checkDir $D8
			if [ $? == 0 ]; then
				mkdir "$D8"
				echo "Creating directory: $D8"
			else
				echo "Directory exists."
			fi

			checkDir $D9
			if [ $? == 0 ]; then
				mkdir "$D9"
				echo "Creating directory: $D9"
			else
				echo "Directory exists."
			fi

			checkDir $D10
			if [ $? == 0 ]; then
					mkdir "$D10"
					echo "Creating directory: $D10"
			else
					echo "Directory exists."
			fi
		fi
	fi

	if [ $ARG_PROD == "false" ]; then
		((STEP++))
		#2: DOWNLOAD AND CLEAN UP
		if [ $JOB == 2 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
				echo "${STEP}: Run XAMPP checks?(y=yes, n=no, e=exit)"
				read RESULT
				if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
					RESULT="N"
				elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
					exit
				else
					RESULT="Y"
				fi
			else
				RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
				echo ""
				echo ""
				echo "Downloading XAMPP..."
				if [ ! -e "$D1/$F1" ]  && [ ! -e "$D1/$F1D" ]; then
					wget "http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.5.28/xampp-linux-x64-5.5.28-0-installer.run/download"
					mv $FTMP1 $D1/$F1
				fi

				echo "Cleaning up.."
				if [ -e "$F1" ]; then
					rm "$F1"
				fi

				if [ -e "$FTMP1" ]; then
					rm "$FTMP1"
				fi

				echo "Installing XAMPP..."
				if [ -e "$D1/$F1" ]; then
					chmod 755 "$D1/$F1"
					sudo $D1/$F1
					mv $D1/$F1 $D1/$F1D
				fi
			fi
		fi

		echo "XAMPP_HOME=$XAMPP_HOME"
		export "XAMPP_HOME=$XAMPP_HOME"

		VAL=`wget -q -O- http://localhost | grep -c "xampp"`
		echo "Testing XMAP, instances of 'xmapp' found in index.html: $VAL"
		
		if [ $VAL > 0 ]; then
			echo "XAMPP Installation success!"
		fi

		if [ -e "0" ]; then
			rm 0
		fi


		#echo ""
		#echo ""
		#echo "Downloading Moodle..."
		#if [ ! -e "$D6/$F2" ]  && [ ! -e "$D6/$F2D" ]; then
		#        wget "https://bitnami.com/redirect/to/70852/bitnami-moodle-2.9.2-0-module-linux-x64-installer.run?bypassauth=false&fb=1&with_popup_skip_signin=1"
		#        mv $FTMP2 $D6/$F2
		#fi

		#if [ -e "$FTMP2" ]; then
		#        rm "$FTMP2"
		#fi

		#echo "Installing Moodle..."
		#echo "$D6/$F2"
		#if [ -e "$D6/$F2" ]; then
		#        chmod 755 "$D6/$F2"
		#        sudo $D6/$F2
		#        mv $D6/$F2 $D6/$F2D
		#fi


		((STEP++))
		#3: XAMPP SERVICES
		if [ $JOB == 3 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
				echo "${STEP}: Run prep XAMPP services?(y=yes, n=no, e=exit)"
				read RESULT
				if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
					RESULT="N"
				elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
					exit
				else
					RESULT="Y"
				fi
			else
				RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
				echo ""
				echo ""
				echo "Starting XAMPP!"
				sudo "$XAMPP_START" start

				echo "Turning off MySQL"
				sudo "$MYSQL_DAEMON" stopmysql
			
				echo "Turning off PROFTP"
				sudo "$PROFTP_DAEMON" stopftp
			fi
		fi
	else
		((STEP++))
		#2: Apache
		if [ $JOB == 2 ] || [ $JOB == -1 ]; then
				if [ ${ARG_INTACTV} == "true" ]; then
						echo "${STEP}: Run Apache install?(y=yes, n=no, e=exit)"
						read RESULT
						if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
								RESULT="N"
						elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
								exit
						else
								RESULT="Y"
						fi
				else
						RESULT="Y"
				fi

				if [ $RESULT == "Y" ]; then
					if [ $ARG_YUM == "true" ]; then
						sudo yum install httpd
					else
						sudo apt-get install apache2
					fi
				fi
		fi


		echo "XAMPP_HOME=$XAMPP_HOME"
		export "XAMPP_HOME=$XAMPP_HOME"


		((STEP++))
		#3: PHP, PERL
		if [ $JOB == 3 ] || [ $JOB == -1 ]; then
				if [ ${ARG_INTACTV} == "true" ]; then
						echo "${STEP}: Run PHP, PERL install?(y=yes, n=no, e=exit)"
						read RESULT
						if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
								RESULT="N"
						elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
								exit
						else
								RESULT="Y"
						fi
				else
						RESULT="Y"
				fi

				if [ $RESULT == "Y" ]; then
						if [ $ARG_YUM == "true" ]; then
								sudo yum install php 
			sudo yum install php-pgsql php-common.x86_64 php-cli.x86_64
			sudo yum install perl
						else
			sudo apt-get install php5
			sudo apt-get install php5-common libapache2-mod-php5 php5-cli php5-mcrypt php5-pgsql php5-curl
			sudo apt-get install perl
						fi
				fi
		fi
	fi


	((STEP++))
	#4: INSTALL LYNX
        if [ $JOB == 4 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run lynx install?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Installing Lynx..."
			if [ $ARG_YUM == "true" ]; then
				sudo yum install lynx
			else
				sudo apt-get install lynx-cur
			fi
		fi
	fi


	((STEP++))
	#5: INSTALL GIT
	if [ $JOB == 5 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git install?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Installing GIT..."
			if [ $ARG_YUM == "true" ]; then
				sudo yum install git
			else
				sudo apt-get install git
			fi
		fi
	fi
	

	((STEP++))
	#6: POSTGRESQL INSTALL
	if [ $JOB == 6 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run PostgreSQL install?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Installing PostgreSQL..."
			if [ $ARG_YUM == "true" ]; then
				sudo yum install postgresql94-server postgresql-contrib
				sudo yum install php-pgsql
			else
				sudo apt-get install postgresql postgresql-contrib
				sudo apt-get install php5-pgsql
			fi
		fi
	fi


	echo "git config --global user.email $GE"
	git config --global user.email $GE

	echo "git config --global user.name \"$GN\""
	git config --global user.name "$GN"


	((STEP++))	
	#7: GIT INITIALIZATION
	if [ $JOB == 7 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git repo initialization?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Get latest InqITS GIT repos..."

			if [ ! -e "$D2/.git" ]; then
				echo "Cloning repo into $D2"
				git clone "https://$GU:$GP@github.com/$GURL1" $D2
			fi

			if [ ! -e "$D7/.git" ]; then
				echo "Cloning repo into $D7"
				git clone "https://$GU:$GP@github.com/$GURL2" $D7
			fi

			if [ ! -e "$D8/.git" ]; then
                                echo "Cloning repo into $D8"
				git clone "https://$GU:$GP@github.com/$GURL3" $D8
			fi
			
			if [ ! -e "$D9/.git" ]; then
                                echo "Cloning repo into $D9"
				git clone "https://$GU:$GP@github.com/$GURL4" $D9
			fi

			if [ ! -e "$D10/.git" ]; then
                                echo "Cloning repo into $D10"
				git clone "https://$GU:$GP@github.com/$GURL5" $D10
			fi
		fi
	fi


	((STEP++))
	#8: GIT PULL
	if [ $JOB == 8 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Git pull?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			if [ -e "$D2" ]; then
				cd $D2
				git pull
				cd ../
			fi

			if [ -e "$D7"  ]; then
				cd $D7
				git pull
				cd ../
			fi

			if [ -e "$D8" ]; then
				cd $D8
				git pull
				cd ../
			fi

			if [ -e "$D9" ]; then
				cd $D9
				git pull
				cd ../
			fi

			if [ -e "$D10" ]; then
					cd $D10
					git pull
					cd ../
			fi
		fi
	fi
	

	((STEP++))
	#9: CURL INSTALL
	if [ $JOB == 9 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Curl install?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
				else
						RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Installing Curl..."
			if [ $ARG_YUM == "true" ]; then
				sudo yum install curl
				sudo yum install libcurl php-curl
			else
				sudo apt-get install curl
				sudo apt-get install libcurl3 php5-curl
			fi
		fi
	fi


	((STEP++))
	#10: INSTALL MUTT
	if [ $JOB == 10 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Mutt install?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Installing Mutt..."
			if [ $ARG_YUM == "true" ]; then
				sudo yum install mutt
			else
				sudo apt-get install mutt
			fi
		fi
	fi


	((STEP++))
	#11: COMPOSER INSTALL
	if [ $JOB == 11 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Composer install?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Installing Composer..."
			if [ ! -e $D5/$F3 ]; then
				curl -sS https://getcomposer.org/installer | ${PHP_BIN} -- --install-dir=./composer
			fi
		fi
	fi


	((STEP++))
	#12: UPDATE PHP DEPENDENCIES
	if [ $JOB == 12 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
					echo "${STEP}: Run update PHP dependencies with composer?(y=yes, n=no, e=exit)"
					read RESULT
					if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
							RESULT="N"
					elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
							exit
					else
							RESULT="Y"
					fi
			else
					RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
					echo ""
					echo ""
					echo "Updating PHP dependencies with composer..."
					cd $D2
					pwd
					sudo $PHPD $COMPD install
					sudo $PHPD $COMPD update
					cd ../
			fi
	fi


	((STEP++))
	#13: PHP PREP
	if [ $JOB == 13 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run PHP config file prep?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Running PHP prep..."
			sudo $PREP_PHP
		fi
	fi


	((STEP++))
	#14: APACHE PREP
        if [ $JOB == 14 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run Apache config prep?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Running Apache prep..."
			sudo $PREP_APACHE
		fi
	fi


	((STEP++))
	#15: PHINX PREP
        if [ $JOB == 15 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run phinx config prep?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Running phinx config..."
			sudo $PREP_PHINX_CONFIG
		fi
	fi


	((STEP++))
	#16: SELF SERVICE PHINX PREP
	if [ $JOB == 16 ] || [ $JOB == -1 ]; then
			if [ ${ARG_INTACTV} == "true" ]; then
					echo "${STEP}: Run self service phinx config prep?(y=yes, n=no, e=exit)"
					read RESULT
					if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
							RESULT="N"
					elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
							exit
					else
							RESULT="Y"
					fi
			else
					RESULT="Y"
			fi

			if [ $RESULT == "Y" ]; then
					echo ""
					echo ""
					echo "Running self service phinx config..."
					sudo $PREP_SS_PHINX_CONFIG
			fi
	fi


	((STEP++))
	#17: PHINX BATCH PREP
	if [ $JOB == 17 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run phinx batch file prep?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Running phinx bat config..."
			sudo $PREP_PHINX_BAT
		fi
	fi

	
	((STEP++))
	#18: INQITS PREP
	if [ $JOB == 18 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run inqits config prep?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Running inqits config..."
			sudo $PREP_INQITS_CONFIG
		fi
	fi

	
	((STEP++))
	#19: MOODLE CONFIG
	if [ $JOB == 19 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run moodle config prep?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
		else
			RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Running moodle config..."
			sudo $PREP_MOODLE_CONFIG
		fi
	fi


	#echo ""
	#echo ""
	#echo "================== PostgreSQL Connection Notes ================="
	#echo "You may need to edit postgresql.conf to alter the external connection settings."
	#echo "If you plan to allow outside access you'll have to set the listening address."
	#echo "Also you'll have to edit pg_hba.conf to set which hosts are allowed to connect."
	#echo ""
	#echo "You must also alter the postgres database account password if you want to connect"
	#echo "to PostgreSQL server via pgAdmin from a remote host. Use the following commands..."
	#echo "sudo -u postgres psql postgres"
	#echo "\\password postgres"
	#echo "\\q"


	((STEP++))
	#20: SETUP POSTGRESQL USER ROLES
	if [ $JOB == 20 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run setup PostgreSQL user roles?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
		else
			RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			if [ $PGHOST == "localhost" ]; then
				echo ""
				echo ""
				echo "Setup PostgreSQL user accounts..."
				sudo -u postgres psql -h ${PGHOST} -p ${PGPORT} -d postgres -c "ALTER ROLE ${PGADMINUSER} WITH PASSWORD '${PGADMINPASS}';"
				echo "sudo -u postgres psql -h ${PGHOST} -p ${PGPORT} -d postgres -c \"ALTER ROLE ${PGADMINUSER} WITH PASSWORD '${PGADMINPASS}';\""

				sudo -u postgres psql -h ${PGHOST} -p ${PGPORT} -d postgres -c "CREATE ROLE ${PGDEVUSER} LOGIN PASSWORD '${PGDEVPASS}';"
				echo "sudo -u postgres psql -h ${PGHOST} -p ${PGPORT} -d postgres -c \"CREATE ROLE ${PGDEVUSER} LOGIN PASSWORD '${PGDEVPASS}';\""
			else
				echo ""
				echo ""
				echo "Setup PostgreSQL user accounts..."
				sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres  -c "ALTER ROLE ${PGADMINUSER} WITH PASSWORD '${PGADMINPASS}';"
				echo "sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c \"ALTER ROLE ${PGADMINUSER} WITH PASSWORD '${PGADMINPASS}';\""
				sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c "CREATE ROLE ${PGDEVUSER} LOGIN PASSWORD '${PGDEVPASS}';"
				echo "sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c \"CREATE ROLE ${PGDEVUSER} LOGIN PASSWORD '${PGDEVPASS}';\""
			fi
		fi
	fi


	((STEP++))
	#21: SETUP POSTGRESQL DATABASES
	if [ $JOB == 21 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run setup PostgreSQL databases?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
		else
			RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
				if [ $PGHOST == "localhost" ]; then
						echo ""
						echo ""
						echo "Setup PostgreSQL databases..."
						
						sudo -u postgres psql -d postgres -p ${PGPORT} -c "CREATE DATABASE ${PGSLINQDB} OWNER ${PGDEVUSER};"
						echo "sudo -u postgres psql -d postgres -p ${PGPORT} -c \"CREATE DATABASE ${PGSLINQDB} OWNER ${PGDEVUSER};\""

						sudo -u postgres psql -d postgres -p ${PGPORT} -c "CREATE DATABASE ${PGMOODLEDB} OWNER ${PGDEVUSER};"
						echo "sudo -u postgres psql -d postgres -p ${PGPORT} -c \"CREATE DATABASE ${PGMOODLEDB} OWNER ${PGDEVUSER};\""

						sudo -u postgres psql -d postgres -p ${PGPORT} -c "CREATE DATABASE ${PGSELFSERVICEDB} OWNER ${PGDEVUSER};"
						echo "sudo -u postgres psql -d postgres -p ${PGPORT} -c \"CREATE DATABASE ${PGSELFSERVICEDB} OWNER ${PGDEVUSER};\""
				else
						echo ""
						echo ""
						echo "Setup PostgreSQL databases..."
						sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c "CREATE DATABASE ${PGSLINQDB} OWNER ${PGDEVUSER};"
						echo "sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c \"CREATE DATABASE ${PGSLINQDB} OWNER ${PGDEVUSER};\""

						sudo -u psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c "CREATE DATABASE ${PGMOODLEDB} OWNER ${PGDEVUSER};"
						echo "sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c \"CREATE DATABASE ${PGMOODLEDB} OWNER ${PGDEVUSER};\""

						sudo -u psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c "CREATE DATABASE ${PGSELFSERVICEDB} OWNER ${PGDEVUSER};"
						echo "sudo psql -U ${PGADMINUSER} -W -h ${PGHOST} -p ${PGPORT} -d postgres -c \"CREATE DATABASE ${PGSELFSERVICEDB} OWNER ${PGDEVUSER};\""
				fi
		fi
	fi


	((STEP++))
	#22: UPDATE FILE SYSTEM DB
        if [ $JOB == 22 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run update file system db (locate)?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
		else
			RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			echo ""
			echo ""
			echo "Update file db..."
			sudo updatedb
		fi
	fi


	((STEP++))
        #23: RESTART APACHE
        if [ $JOB == 23 ] || [ $JOB == -1 ]; then
		if [ ${ARG_INTACTV} == "true" ]; then
			echo "${STEP}: Run apache restart?(y=yes, n=no, e=exit)"
			read RESULT
			if [ ${RESULT} == "n" ] || [ ${RESULT} == "N" ]; then
				RESULT="N"
			elif [ ${RESULT} == "e" ] || [ ${RESULT} == "E" ]; then
				exit
			else
				RESULT="Y"
			fi
                else
                        RESULT="Y"
		fi

		if [ $RESULT == "Y" ]; then
			if [ $ARG_PROD == "true" ]; then
				echo ""
				echo ""
				echo "Restart Apache!"
				sudo service httpd restart
			else
				echo ""
				echo ""
				echo "Restart Apache!"
				sudo "$APACHE_DAEMON" stopapache
				sudo "$APACHE_DAEMON" startapache
				#sudo "$APACHE_DAEMON" reloadapache
			fi
		fi
	fi
fi