Skip to content

Commit b0c7e4b

Browse files
authored
Update serverinformation.sh
1 parent 28b2124 commit b0c7e4b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

serverinformation.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
mkdir -p /Inventory
44
sudo chmod -R 777 /Inventory/
55
mkdir -p /tmp/asset
6-
touch /tmp/asset/`hostname`.txt
6+
touch /tmp/asset/hostname.txt
7+
if [ -f /tmp/asset/hostname.txt ];then
8+
echo "File /tmp/asset/hostname.txt Exists"
9+
else
10+
mkdir /tmp/asset
11+
touch /tmp/asset/hostname.txt
12+
fi
713
touch /tmp/temptext
814
TEMP=/tmp/temptext
9-
LOG=`ls /tmp/asset/*.txt`
15+
LOG=`ls /tmp/asset/hostname.txt`
1016
echo "## Host Information" > $LOG
1117
echo "Host Name : `hostname` " >> $LOG
1218
echo "`sudo /sbin/ifconfig -a |grep "inet" | awk 'BEGIN { FS = ":" } ; { print $2 }'`" >> $TEMP

0 commit comments

Comments
 (0)