Apache Start Stop Script
#
# Apache Start Stop Script
#
# chkconfig: 345 80 20
# description: Control Apache
## exit 0 -> betik basarili bir sekilde calistirildi
## exit 1 -> httpd.conf dosyasi yok
## exit 2 -> Apache Zaten calisiyor
## exit 3 -> Apache zaten calismiyor
## exit 4 -> start stop restart opsiyonlari kullanilabilir.
export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:$PATH:"
APACHE_CONF="/chroot/apache-chroot/apache/conf/httpd.conf"
MYSQLD_PID="/chroot/mysqld-chroot/mysqld/var/`uname -n | cut -d '.' -f1`.pid"
APACHE_SOCKET_PATH="/chroot/apache-chroot/apache/mysqld/mysql-socket/mysql.sock"
MYSQL_SOCKET_PATH="/chroot/mysqld-chroot/mysqld/mysql-socket/mysql.sock"
APACHE_CHROOT_PATH="/chroot/apache-chroot/"
HTTPD_PID="/chroot/apache-chroot/apache/run/httpd.pid"
if [ ! -f $APACHE_CONF ]
then
echo "httpd.conf Dosyasi Bulunamadi !!!"
exit 1
fi
case "$1" in
'start')
if [ -f $HTTPD_PID ]
then
echo "Apache Zaten Calisiyor"
exit 2
else
if [ -f $MYSQLD_PID ]
then
rm -f $APACHE_SOCKET_PATH
chroot $APACHE_CHROOT_PATH /apache/bin/httpd -k start
ln $MYSQL_SOCKET_PATH $APACHE_SOCKET_PATH
echo "Starting httpd: [OK]"
exit 0
else
rm -f $APACHE_SOCKET_PATH
chroot $APACHE_CHROOT_PATH /apache/bin/httpd -k start
echo "Starting httpd: [OK]"
exit 0
fi
fi
;;
'stop')
if [ -f $HTTPD_PID ]
then
rm -f $APACHE_SOCKET_PATH
chroot $APACHE_CHROOT_PATH /apache/bin/httpd -k stop
rm -f $HTTPD_PID
echo "Shutting down httpd: [OK]"
exit 0
else
echo "Apache Zaten Calismiyor!!!"
exit 3
fi
;;
'restart')
$0 stop
sleep 3
$0 start
exit 0
;;
*)
echo "Usage: $0 { start | stop | restart }"
exit 4
;;
esac
0 comments:
Post a Comment