From 14ae45e9fcad1e1e2b444066b73f31d986d3a845 Mon Sep 17 00:00:00 2001 From: Karanbir Singh Date: May 10 2011 13:49:14 +0000 Subject: include the untracked stuff --- diff --git a/Authors b/Authors index 303913a..4ed564f 100644 --- a/Authors +++ b/Authors @@ -3,3 +3,5 @@ Please add your name to this list with your first commit request Karanbir Singh Fabian +Steve Barnes + diff --git a/tests/0_lib/0_config b/tests/0_lib/0_config new file mode 100644 index 0000000..19940d6 --- /dev/null +++ b/tests/0_lib/0_config @@ -0,0 +1,8 @@ +#!/bin/bash + +# Description: All the common static content can go here + +PASS=0 +FAIL=1 + +YUM=/usr/bin/yum diff --git a/tests/0_lib/install_package.sh b/tests/0_lib/install_package.sh new file mode 100644 index 0000000..7afefb8 --- /dev/null +++ b/tests/0_lib/install_package.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +function t_InstallPackage(){ + + for P in $*; do + echo -n "[+] Attempting yum install of '$P'..." + + $YUM -y -d0 install $P &>/dev/null + RETVAL=$? + if [ $RETVAL -ne 0 ]; then + echo "FAIL: yum install of '$P' failed ($RETVAL)" + exit $FAIL + fi + echo "OK" + done +} diff --git a/tests/r_lamp/0_lamp_install.sh b/tests/r_lamp/0_lamp_install.sh new file mode 100644 index 0000000..4b2cc6e --- /dev/null +++ b/tests/r_lamp/0_lamp_install.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Author: Steve Barnes (steve@echo.id.au) +# Filename: 0_lamp_install.sh +# Version: 0.1.1 +# Last Updated: Saturday, 30 April 2011 3:52 PM AEST +# Description: A simple Bash script to install a LAMP stack (Apache, MySQL (server + client) and PHP)) via yum. + +t_InstallPackages httpd mysql-server php + diff --git a/tests/r_lamp/1_lamp_check.sh b/tests/r_lamp/1_lamp_check.sh new file mode 100644 index 0000000..eba0799 --- /dev/null +++ b/tests/r_lamp/1_lamp_check.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Author: Steve Barnes (steve@echo.id.au) +# Filename: 1_lamp_check.sh +# Version: 0.1 +# Last Updated: Saturday, 30 April 2011 2:23 PM AEST +# Description: A simple Bash script to start LAMP daemons (httpd, mysqld), and confirm PHP is working. + +readonly PASS=0 +readonly FAIL=1 + +readonly DAEMONS=( httpd mysqld ) + +readonly SERVICE=/sbin/service +readonly PHP_BIN=/usr/bin/php +readonly PHP_CHECK=/tmp/check.php + +# Make sure we cleanup after ourselves. +trap "/bin/rm -f $PHP_CHECK" EXIT + +echo "[+] Starting LAMP daemon startup test" + +# Iterate through our daemons, start each and check for the presence of each process +for D in "${DAEMONS[@]}" +do + echo -n "[+] Attempting startup of '$D'..." + + $SERVICE $D start &>/dev/null + + RETVAL=$? + + if [ $RETVAL -ne 0 ]; then + + echo "FAIL: service startup for '$D' failed ($RETVAL)" + exit $FAIL + + fi + + # See if our process exists + PIDS=$(pidof $D) + + if [ -z "$PIDS" ]; then + + echo "FAIL: couldn't find '$D' in the process list." + exit $FAIL + fi + + echo "OK" + +done + +# Finally, a basic check to see if PHP is working correctly. + +echo -n "[+] Performing php script check..." + +cat < $PHP_CHECK + +EOL + +RETVAL=$PHP_BIN $PHP_CHECK &>/dev/null + +if [ $RETVAL -ne 0 ]; then + + echo "FAIL: php_info() check failed ($RETVAL)" + exit $FAIL + +fi + +echo "OK" +echo "[+] Finished" \ No newline at end of file