- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-13-2011 03:59 AM
01-13-2011 03:59 AM
Hi,
Please suggest about:
1. AND, OR operations inside an IF condition
2. AND, OR operations inside GREP
AND and OR operations give confusions and issues all the times(which braket"(" or "[[" or, ,,etc,...). can you please write how to use them with simple examples.
ISSUE: i have this output in a file(output-file). i would like to run an opcmsg if either rds, crs, mmd or kms is down.
OUTPUT-FILE:
**************
oper@corvette:/home/oper=>omnisv -status
ProcName Status [PID]
===============================
rds : Down
crs : Active [9569]
mmd : Active [9566]
kms : Active [9567]
omnitrig: Active
uiproxy : Active [9571]
===============================
Status: At least one of Data Protector relevant processes/services is not running.
**************
i wrote like this:
RDS=`grep -c rds output-file | grep -c Down`
CRS=`grep -c crs output-file | grep -c Down`
MMD=`grep -c mmd output-file | grep -c Down`
KMS=`grep -c kms output-file | grep -c Down`
if[[ $RDS -eq 1 || $CRS -eq 1 || $MMD -eq 1 || $KMS -eq 1 ]]
then
echo "At least one of Data Protector relevant processes/services is not running."
fi
Please suggest about:
1. AND, OR operations inside an IF condition
2. AND, OR operations inside GREP
AND and OR operations give confusions and issues all the times(which braket"(" or "[[" or, ,,etc,...). can you please write how to use them with simple examples.
ISSUE: i have this output in a file(output-file). i would like to run an opcmsg if either rds, crs, mmd or kms is down.
OUTPUT-FILE:
**************
oper@corvette:/home/oper=>omnisv -status
ProcName Status [PID]
===============================
rds : Down
crs : Active [9569]
mmd : Active [9566]
kms : Active [9567]
omnitrig: Active
uiproxy : Active [9571]
===============================
Status: At least one of Data Protector relevant processes/services is not running.
**************
i wrote like this:
RDS=`grep -c rds output-file | grep -c Down`
CRS=`grep -c crs output-file | grep -c Down`
MMD=`grep -c mmd output-file | grep -c Down`
KMS=`grep -c kms output-file | grep -c Down`
if[[ $RDS -eq 1 || $CRS -eq 1 || $MMD -eq 1 || $KMS -eq 1 ]]
then
echo "At least one of Data Protector relevant processes/services is not running."
fi
Solved! Go to Solution.
- Tags:
- grep