Hi I am wiritng a simple function to check on three different files existance in which it should return "yes" if ALL three files exist and "Partially" if one or more file exists and "no" if none of the three exist.
The functions is called IsPortalDown and it has a case switch; NodeOne is the one in use at this point.
Here's my function
function IsPortalDown() {
case "$1" in
NodeOne )
if [[ -f $wpsdmgr ]] && [[ -f $wpsnodeagent ]] && [[ ! -f $wpsserver ]];
then
echo "Yes"
elif [[ ! -f $wpsdmgr ]] || [[ ! -f $wpsnodeagent ]] || [[ ! -f $wpsserver ]];
then
echo "Partially"
else
echo "No"
fi;
;;
NodeTwo )
;;
esac
}
A few constants are defined to clean things up a little bit. See below
PortalProfileLogsDir=/opt/IBM/WebSphere/wp_profile/logs
WPSDMGRProfileLogsDir=/opt/IBM/WebSphere/AppServer/profiles/dmgr01/logs
wpsdmgr=$WPSDMGRProfileLogsDir/dmgr/dmgr.pid
wpsnodeagent=$PortalProfileLogsDir/nodeagent/nodeagent.pid
wpsserver=$PortalProfileLogsDir/WebSphere_Portal/WebSphere_Portal.pid
Here's how I call the funtion and expected result below.
IsPortalDown NodeOne
If all three files exist the output shall be as below
[wpssrvr@tstdydalbpt0101 dmgr]$ IsPortalDown NodeOne
Yes
If one of the three files exist the output shall be as below
[wpssrvr@tstdydalbpt0101 dmgr]$ IsPortalDown NodeOne
Partially
If none of the three files exist the output shall be as below
[wpssrvr@tstdydalbpt0101 dmgr]$ IsPortalDown NodeOne
No
My issue now is that if one of the three files or all three files do not exist I am constantly getting Yes instead of Partially.
Any help is appreciated. Thanks
Aucun commentaire:
Enregistrer un commentaire