I have a script that currently runs fine and I need to add or || (or) condition to the if statement and I'm not sure the exact syntax as it relates to the use of brackets.
my current script starts like this:
errLog="/usr/local/website-logs/error.log"
apacheRestart="service httpd restart"
failRegex="exit signal Segmentation fault"
scriptLog="/usr/local/websites-logs/`basename $0`.log"
while true; do
echo "`date` (re)starting control loop"
tail --follow=name --retry -n 0 "$errLog" 2>/dev/null | while read logLine; do
if [[ `echo "$logLine" | egrep "$failRegex"` ]]; then
I want to add an OR condition to my if statement and wondered if this is the correct syntax?
#!/bin/bash
errLog="/usr/local/website-logs/error.log"
apacheRestart="service httpd restart"
failRegex="exit signal Segmentation fault"
failRegex1="server seems busy"
scriptLog="/usr/local/websites-logs/`basename $0`.log"
while true; do
echo "`date` (re)starting control loop"
tail --follow=name --retry -n 0 "$errLog" 2>/dev/null | while read logLine; do
if [[ `echo "$logLine" | egrep "$failRegex"` ]] || [[ `echo "$logLine" | egrep "$failRegex1"` ]]; then
---------- Post updated at 12:38 PM ---------- Previous update was at 12:33 PM ----------
and is there some special need to the double brackets in this script I found online?