Я пытаюсь смонтировать, как показано ниже, где точка монтирования зависит от версии:
1) Найдите, установлены ли какие-либо из нижеприведенных 2.
2) Найдите версию RHEL, затем установите одну из следующих
- mount -o soft 123.45.678.9:/web /mnt3 (RHEL 5)
- mount -o vers = 3 123.45.678.9:/web /mnt3 (RHEL 6)
3) Если не получается поставить заявление.
Пробовал эти 2 кода
первый
mount > /tmp/mountlog;
if grep -ohw "soft,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 5 MOUNT \e[1;33mALREADY\e[00m AVAILABLE \e[1;33m-PASSED\e[00m ";
elif grep -ohw "nfsvers=3,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 6 MOUNT \e[1;33mALREADY\e[00m AVAILABLE \e[1;33m-PASSED\e[00m ";
elif grep -ohw "5.*" /tmp/red; mount -o soft 123.45.678.9:/web /mnt3 &>/dev/null; then mount > /tmp/mountlog; fi
if grep -ohw "soft,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 5 MOUNT AVAILABLE \e[1;33m-PASSED\e[00m ";
elif grep -ohw "6.*" /tmp/red; mount -o vers=3 123.45.678.9:/web /mnt3 &>/dev/null; then mount > /tmp/mountlog;
if grep -ohw "nfsvers=3,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 6 MOUNT AVAILABLE \e[1;33m-PASSED\e[00m ";
else echo -e " MOUNT DEVICE NOT AVAILABLE Or NOT VALID RHEL VERSION 5 or 6. \e[00;31mFAILED\e[00m "; fi; fi | tee -a /tmp/log;
второй
mount > /tmp/mountlog;
if grep -ohw "soft,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 5 MOUNT \e[1;33mALREADY\e[00m AVAILABLE \e[1;33m-PASSED\e[00m ";
elif grep -ohw "nfsvers=3,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 6 MOUNT \e[1;33mALREADY\e[00m AVAILABLE \e[1;33m-PASSED\e[00m ";
elif grep -ohw "5.*" /tmp/red; mount -o soft 123.45.678.9:/web /mnt3 &>/dev/null; then mount > /tmp/mountlog; fi
if grep -ohw "soft,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 5 MOUNT AVAILABLE \e[1;33m-PASSED\e[00m ";
elif grep -ohw "6.*" /tmp/red; mount -o vers=3 123.45.678.9:/web /mnt3 &>/dev/null; then mount > /tmp/mountlog; fi
if grep -ohw "nfsvers=3,addr=123.45.678.9" /tmp/mountlog; then echo -e " RHEL 6 MOUNT AVAILABLE \e[1;33m-PASSED\e[00m ";
else echo -e " MOUNT DEVICE NOT AVAILABLE Or NOT VALID RHEL VERSION 5 or 6. \e[00;31mFAILED\e[00m "; fi | tee -a /tmp/log;