• No related posts.

      • No related posts.

        • No related posts.

          • No related posts.

              No related posts.

            Script to autorestart httpd server if it fails

            I use this script on a cpanel server..if output of pgrep command is 0 then the $restart command is issued

            #!/bin/bash
            restart=”/scripts/restartsrv_httpd”
            pgrep httpd || $restart
            exit 0

            If its a VPS then I might add to clear the Semaphore Arrays.

            for i in `ipcs -s | grep nobody | awk ‘{print $2}’`; do ipcrm -s $i; done

            Then I put this script into Cron to run every 5 minutes.

            # MIN HOUR DAYOFMONTH MONTH DAYOFWEEK COMMAND
            */5 * * * * /root/checkhttp.sh

            Related posts:

            1. Perl script to read .dbx files
            2. Monitor server stats
            3. Concurrent Version System CVS Client/Server
            This entry was posted in Scripting and tagged , , , , , , , , .

            Leave a Reply