From 314eadcd683551bd79b644de05cbf0e425c84f83 Mon Sep 17 00:00:00 2001
From: Kazunori INOUE <kazunori_inoue@newson.co.jp>
Date: Tue, 9 Jun 2020 13:30:32 +0000
Subject: [PATCH] nfsserver: prevent error messages when /etc/sysconfig/nfs
does not exist
---
heartbeat/nfsserver-redhat.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/heartbeat/nfsserver-redhat.sh b/heartbeat/nfsserver-redhat.sh
index cef0862ee..73a70c186 100644
--- a/heartbeat/nfsserver-redhat.sh
+++ b/heartbeat/nfsserver-redhat.sh
@@ -150,10 +150,12 @@ set_env_args()
# override local nfs config. preserve previous local config though.
if [ -s $tmpconfig ]; then
- cat $NFS_SYSCONFIG | grep -q -e "$NFS_SYSCONFIG_AUTOGEN_TAG" > /dev/null 2>&1
- if [ $? -ne 0 ]; then
- # backup local nfs config if it doesn't have our HA autogen tag in it.
- mv -f $NFS_SYSCONFIG $NFS_SYSCONFIG_LOCAL_BACKUP
+ if [ -f "$NFS_SYSCONFIG" ]; then
+ cat $NFS_SYSCONFIG | grep -q -e "$NFS_SYSCONFIG_AUTOGEN_TAG" > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ # backup local nfs config if it doesn't have our HA autogen tag in it.
+ mv -f $NFS_SYSCONFIG $NFS_SYSCONFIG_LOCAL_BACKUP
+ fi
fi
cat $tmpconfig | grep -q -e "$NFS_SYSCONFIG_AUTOGEN_TAG" > /dev/null 2>&1