Current File : //etc/zpanel/panel/restartjavascript.sh
#opendkim restart script end
PGREP="/usr/bin/pgrep"
LSOF_LIB=`whereis lsof | awk '{print $2}'`
HTTPD_LISTEN=`$LSOF_LIB -i tcp:8080 | awk '{print$1}' | awk 'END{print}'`
PORTEIGHTY=`$LSOF_LIB -i tcp:80 | awk '{print$1}' | awk 'END{print}'`
if [[ $PORTEIGHTY = "" ]]
then
echo "No one running on the port 80"
        if [[ $HTTPD_LISTEN = "httpd" ]]
        then
        echo "httpd listen 8080" 
                echo "if varnish is not running Need to restart varnish"

                JAVA_CHK=`whereis java | awk '{print $2}'`
                if [[ $JAVA_CHK = "" ]]
                then
                echo "No java"
                        VARNISH="varnish"
                        VARNISHRESTART="/sbin/service varnish restart"
                        $PGREP ${VARNISH}
                        if [ $? -ne 0 ]
                        then
                         $VARNISHRESTART
                        fi
                else
                /usr/local/tomcat8//bin/shutdown.sh 
		/usr/local/tomcat8//bin/startup.sh
                fi
        else
        echo "No need to check it"
        fi
else
echo "something running on 80"
fi