説明†最初にapacheを停止させて、もしもプロセスが残っていたらkillallで強制終了します。 スクリプト†#!/bin/bash /etc/init.d/httpd stop sleep 2 PSNUM=`ps aux | grep httpd | wc -l` if [ ${PSNUM} -gt 1 ];then killall httpd ;fi sleep 2 /etc/init.d/httpd start if [ $? -eq 0 ];then echo "Apache restart OK";else service httpd start;exit 9;fi |