| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| readonly DAEMONS=( httpd mysqld ) |
| |
| readonly SERVICE=/sbin/service |
| readonly PHP_BIN=/usr/bin/php |
| readonly PHP_CHECK=/tmp/check.php |
| |
| |
| trap "/bin/rm -f $PHP_CHECK" EXIT |
| |
| t_Log "Running $0 - starting LAMP daemon startup test" |
| |
| |
| for D in "${DAEMONS[@]}" |
| do |
| t_Log "Attempting startup of '$D'" |
| |
| $SERVICE $D start &>/dev/null |
| |
| RETVAL=$? |
| |
| if [ $RETVAL -ne 0 ]; then |
| |
| t_Log "FAIL: service startup for '$D' failed ($RETVAL)" |
| exit $FAIL |
| |
| fi |
| |
| |
| PIDS=$(pidof $D) |
| |
| if [ -z "$PIDS" ]; then |
| |
| t_Log "FAIL: couldn't find '$D' in the process list." |
| exit $FAIL |
| fi |
| |
| echo "OK" |
| |
| done |
| |
| |
| |
| t_Log "Performing php script check..." |
| |
| cat <<EOL > $PHP_CHECK |
| <?php |
| return phpinfo(); |
| ?> |
| EOL |
| |
| RETVAL=$PHP_BIN $PHP_CHECK &>/dev/null |
| |
| if [ $RETVAL -ne 0 ]; then |
| |
| t_Log "FAIL: php_info() check failed ($RETVAL)" |
| exit $FAIL |
| |
| fi |