From b0c7e4b0104281f60108abb77451710b6949eec0 Mon Sep 17 00:00:00 2001 From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com> Date: Fri, 14 Jul 2023 19:36:33 +0530 Subject: [PATCH] Update serverinformation.sh --- serverinformation.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/serverinformation.sh b/serverinformation.sh index 221e037..85d4d14 100644 --- a/serverinformation.sh +++ b/serverinformation.sh @@ -3,10 +3,16 @@ mkdir -p /Inventory sudo chmod -R 777 /Inventory/ mkdir -p /tmp/asset -touch /tmp/asset/`hostname`.txt +touch /tmp/asset/hostname.txt +if [ -f /tmp/asset/hostname.txt ];then + echo "File /tmp/asset/hostname.txt Exists" +else + mkdir /tmp/asset + touch /tmp/asset/hostname.txt +fi touch /tmp/temptext TEMP=/tmp/temptext -LOG=`ls /tmp/asset/*.txt` +LOG=`ls /tmp/asset/hostname.txt` echo "## Host Information" > $LOG echo "Host Name : `hostname` " >> $LOG echo "`sudo /sbin/ifconfig -a |grep "inet" | awk 'BEGIN { FS = ":" } ; { print $2 }'`" >> $TEMP