Monday, 21 October 2013

Script for Automatic Restart of Apache Server

 Note that below script will check whether APACHE is up or not.

----------------------------------------------------------------------------------------------
#!/bin/bash

# RHEL / CentOS / Fedora Linux restart command
RESTART="/sbin/service httpd restart"

# uncomment if you are using Debian / Ubuntu Linux
#RESTART="/etc/init.d/apache2 restart"

#path to pgrep command
PGREP="/usr/bin/pgrep"


# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
HTTPD="httpd"

# find httpd pid

$PGREP ${HTTPD}

if [ $? -ne 0 ] # if apache not running

then
# restart apache
$RESTART
fi

No comments:

Post a Comment

Configure EKS Persistent Static Storage With Elastic File System Using Terraform

  checkout :https://youtu.be/QuUIgQWBBZM