From 11ec1405467202ebb7eea2a2abd0f602b4b26772 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Mon, 5 Jul 2021 15:15:54 +0530
Subject: [PATCH 01/24] Create generate_win_host_config.sh

To Generate Windows Host Configuration with in Minute, Generate N number of servers.
---
 generate_win_host_config.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 generate_win_host_config.sh

diff --git a/generate_win_host_config.sh b/generate_win_host_config.sh
new file mode 100644
index 0000000..cc6259e
--- /dev/null
+++ b/generate_win_host_config.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+## Purpose: To Generate Nagios Configuration files within minute of time.
+## Author: Ankam Ravi Kumar
+
+mkdir -p /scripts/WinServers
+cat  /scripts/serverlist.txt | while read LINE
+do
+    HostIP=`echo $LINE | cut -d, -f1`
+    HostName=`echo $LINE | cut -d, -f2`
+
+NSCLIENTSTATE=$(/usr/local/nagios/libexec/check_nt -H $HostIP -p 12489 -v CLIENTVERSION -s Password | echo $?)
+if [ $NSCLIENTSTATE -eq 0 ]; then
+    sed -e "s/XXXX/$HostName/g; s/ZZZZ/$HostIP/g" /scripts/Template-Windows.cfg > /scripts/WinServers/$HostName.cfg
+
+for i in D E F G H I J K L M N O P Q R S T U V W X Y Z;
+do
+/usr/local/nagios/libexec/check_nt -H $HostIP -p 12489 -v USEDDISKSPACE -s Password -l $i -w 90 -c 95
+COMMANDSTATUS=$(echo $?)
+if [ $COMMANDSTATUS -eq 0 ] || [ $COMMANDSTATUS -eq 2 ];then
+sed -e "s/XXXX/$HostName/g; s/ZZZZ/$i/g" /scripts/Drives.cfg >> /scripts/WinServers/$HostName.cfg
+fi
+done
+fi
+done

From b4552a96d0491967a0a1c85973f149b958ec0793 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Wed, 21 Jul 2021 06:44:10 +0530
Subject: [PATCH 02/24] Update for-loop.sh

---
 for-loop.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/for-loop.sh b/for-loop.sh
index d399c5f..d431716 100644
--- a/for-loop.sh
+++ b/for-loop.sh
@@ -6,14 +6,14 @@
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #
-for i in `cat hostfile`
+for server in `cat /scripts/servers`
 do
-ping -c 1 $i > /tmp/pingresults
+ping -c 1 $server > /tmp/ping
 valid=`echo $?`
-if [ $valid -gt 1 ]; then
-echo "$i Host is not reachable"
+if [ $valid -eq 0 ]; then
+echo "$server is up"
 else
-echo "$i Host is Up"
+echo "$server is Down"
 fi
 done
 # END #

From a4c4cd8b8a497161d4ca6b34fc1a5ea62868975a Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 5 Aug 2021 21:47:24 +0530
Subject: [PATCH 03/24] Create AutomateLoginSSH.sh

Expect command examples
---
 AutomateLoginSSH.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 AutomateLoginSSH.sh

diff --git a/AutomateLoginSSH.sh b/AutomateLoginSSH.sh
new file mode 100644
index 0000000..2550268
--- /dev/null
+++ b/AutomateLoginSSH.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/expect -f
+## Testing expect command
+
+## echo the test
+puts "\nGet HostName\n"
+
+## execute ssh command to connect to remote host
+spawn ssh 192.168.175.130 "hostname"
+
+## Look for password string
+expect "password:"
+
+## Send the password
+send "redhat\r"
+
+puts "\nGet df command output\n"
+spawn ssh 192.168.175.130 "df -h"
+expect "password:"
+send "redhat\r"
+interact

From b8659a9cf40461a1306ee95a9aed3e0302f11aea Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 5 Aug 2021 21:49:07 +0530
Subject: [PATCH 04/24] Create questions.sh

Look for answers.sh file
---
 questions.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 questions.sh

diff --git a/questions.sh b/questions.sh
new file mode 100644
index 0000000..c93a791
--- /dev/null
+++ b/questions.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+## Questions
+
+echo "Hi"
+read $REPLY
+
+echo "How are you?"
+read $REPLY
+
+echo "Whats your Name?"
+read $REPLY

From b8003a2cd14162cf87a862ce8f7437f6230cd7d3 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 5 Aug 2021 21:49:42 +0530
Subject: [PATCH 05/24] Create answers.sh

Execute questions and auto answer
---
 answers.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 answers.sh

diff --git a/answers.sh b/answers.sh
new file mode 100644
index 0000000..697f19b
--- /dev/null
+++ b/answers.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/expect
+
+set timeout -1
+
+spawn ./questions.sh
+expect "Hi\r"
+send -- "Hi\r"
+
+expect "How are you?\r"
+send -- "I am fine\r"
+
+expect "Whats your Name?\r"
+send -- "My name is Ravi\r"
+
+expect eof

From 92439bf1ed3de0dc4d09e526a948b50a746e39f6 Mon Sep 17 00:00:00 2001
From: FastFingertips <bugra.coskun@outlook.com>
Date: Wed, 22 Dec 2021 07:37:25 +0300
Subject: [PATCH 06/24] Update while-loop.sh

---
 while-loop.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/while-loop.sh b/while-loop.sh
index b636866..3f314c7 100644
--- a/while-loop.sh
+++ b/while-loop.sh
@@ -1,8 +1,10 @@
-While Loop Example, print any given number table.
-
 #!/bin/bash
-## While Loop Example with 2 table
-echo -e "Please provide one value:\c"
+# While Loop Example with 2 table, print any given number table.
+# See Full Explanation of this above shell script [while loop](https://www.youtube.com/Techarkit?sub_confirmation=1)
+
+#START
+
+echo -e "Please provide one value: \c"
 read -r c
 i=1
 while [ $i -le 10 ]
@@ -12,4 +14,4 @@ echo "$c * $i = $b"
 i=`expr $i + 1`
 done
 
-See Full Explanation of this above shell script [while loop](https://www.youtube.com/Techarkit?sub_confirmation=1)
+#END
\ No newline at end of file

From 804a59853e350688f6e9cadb6840db229b52ef2d Mon Sep 17 00:00:00 2001
From: FastFingertips <bugra.coskun@outlook.com>
Date: Wed, 22 Dec 2021 07:46:20 +0300
Subject: [PATCH 07/24] Update agtb.sh

---
 agtb.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/agtb.sh b/agtb.sh
index ac23317..0a67093 100644
--- a/agtb.sh
+++ b/agtb.sh
@@ -7,14 +7,14 @@
 #Author: Ankam Ravi Kumar
 # START #
 
-echo "enter the a vloue $a"
+echo -e "enter the a value: \c"
 read a
-echo "enter the b volue $b"
+echo -e "enter the b value: \c"
 read b
 if test "$a" -gt "$b" ; then
         echo "$a is greater than $b"
 else
-echo "$b is greater than $a"
+        echo "$b is greater than $a"
 fi
 
 # END #
\ No newline at end of file

From db20252cfcbd1934d28382804a4fd5b0703a4c7f Mon Sep 17 00:00:00 2001
From: FastFingertips <bugra.coskun@outlook.com>
Date: Wed, 22 Dec 2021 08:21:15 +0300
Subject: [PATCH 08/24] fix syntax

---
 Arthemetic-Operators.sh  | 1 +
 arkit.co.in-nested-if.sh | 1 +
 array.sh                 | 1 +
 details.sh               | 2 +-
 hi.sh                    | 8 ++++----
 if-elif-if.sh            | 1 +
 if-else-statement.sh     | 2 +-
 info.sh                  | 4 ++--
 myfirstscript.sh         | 2 +-
 nestedif.sh              | 1 +
 or-operator.sh           | 5 +++--
 userexists.sh            | 2 +-
 variables.sh             | 1 +
 13 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/Arthemetic-Operators.sh b/Arthemetic-Operators.sh
index 0957818..0a29f3f 100644
--- a/Arthemetic-Operators.sh
+++ b/Arthemetic-Operators.sh
@@ -5,6 +5,7 @@
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #
+
 echo -e "Please enter some value: \c"
 read -r a
 echo -e "Please enter another value: \c"
diff --git a/arkit.co.in-nested-if.sh b/arkit.co.in-nested-if.sh
index 5be4b8d..17d421b 100644
--- a/arkit.co.in-nested-if.sh
+++ b/arkit.co.in-nested-if.sh
@@ -5,6 +5,7 @@
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #
+
 echo -e "Please Enter Maths Marks: \c"
 read -r m
 echo -e "Please Enter Physics Marks: \c"
diff --git a/array.sh b/array.sh
index ca7d6f8..7c61603 100644
--- a/array.sh
+++ b/array.sh
@@ -6,6 +6,7 @@
 #WebSite: https://arkit.co.in
 #Author: Ankam Ravi Kumar
 # START #
+
 fruits=( "Apple" "Orange" "Banana" "Sapota" )
 fruits[3]='Green Apple'
 for fruit in ${fruits[@]}
diff --git a/details.sh b/details.sh
index 8a64338..cf701a3 100644
--- a/details.sh
+++ b/details.sh
@@ -7,7 +7,7 @@
 #Author: Ankam Ravi Kumar
 # START #
 
-echo "WEL COME TO $USER"
+echo "WEL COME TO $USERNAME"
 echo "Your present working directory is `pwd`"
 echo "current logged in users are `who`"
 echo "Today date is `date`"
diff --git a/hi.sh b/hi.sh
index b0365ef..6652c64 100644
--- a/hi.sh
+++ b/hi.sh
@@ -9,13 +9,13 @@
 
 tmp=`date | cut -c12-13`
 if [ $tmp -lt 11 ] ; then
-echo "Good Mornind have a nice day $USER"
+echo "Good Mornind have a nice day $USERNAME"
 elif [ $tmp -gt 11 -a $tmp -lt 16 ] ; then
-echo "Good Ofter noon $USER"
+echo "Good Ofter noon $USERNAME"
 elif [ $tmp -gt 15 -a $tmp -lt 19 ] ; then
-echo "Good Evening $USER"
+echo "Good Evening $USERNAME"
 else 
-echo "Good Night Sweet dreams $USER"
+echo "Good Night Sweet dreams $USERNAME"
 fi
 echo "Now the time is `date |cut -c12-19`"
 
diff --git a/if-elif-if.sh b/if-elif-if.sh
index ee2e09b..da88e28 100644
--- a/if-elif-if.sh
+++ b/if-elif-if.sh
@@ -5,6 +5,7 @@
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #
+
 echo -e "Please Enter a Value: \c"
 read -r a
 echo -e "Please Enter b Value: \c"
diff --git a/if-else-statement.sh b/if-else-statement.sh
index 1393446..7e5b04f 100644
--- a/if-else-statement.sh
+++ b/if-else-statement.sh
@@ -6,7 +6,7 @@
 #Website: https://arkit.co.in
 #Author: Ankam Ravi Kumar
 # START #
-echo -e "Enter any value> \c"
+echo -e "Enter any value: \c"
 read -r a
 echo -e "Enter any value: \c"
 read -r b
diff --git a/info.sh b/info.sh
index b32785c..caac61a 100644
--- a/info.sh
+++ b/info.sh
@@ -10,8 +10,8 @@
 echo "Hi you there"
 echo "what is your name? (Type your name here and press Enter)"
 read NM
-echo "Hi  $NM Good Morning"
-echo "your currently logged in as $USER"
+echo "Hi $NM Good Morning"
+echo "your currently logged in as $USERNAME"
 echo "your present working directory is `pwd`"
 
 # END #
diff --git a/myfirstscript.sh b/myfirstscript.sh
index ad53bc9..2c39c40 100644
--- a/myfirstscript.sh
+++ b/myfirstscript.sh
@@ -7,7 +7,7 @@
 #Modified by:
 
 # START
-echo "Welcome $USER"
+echo "Welcome $USERNAME"
 echo "Your present working directory is `pwd`"
 echo "Today date is `date`"
 # END
diff --git a/nestedif.sh b/nestedif.sh
index 5be4b8d..17d421b 100644
--- a/nestedif.sh
+++ b/nestedif.sh
@@ -5,6 +5,7 @@
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #
+
 echo -e "Please Enter Maths Marks: \c"
 read -r m
 echo -e "Please Enter Physics Marks: \c"
diff --git a/or-operator.sh b/or-operator.sh
index 5a66bd7..2931df0 100644
--- a/or-operator.sh
+++ b/or-operator.sh
@@ -5,7 +5,8 @@
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #
-echo -e "Enter First Numberic Value: \c"
+
+echo -e "Enter First Numeric Value: \c"
 read -r t
 echo -e "Enter Second Numeric Value: \c"
 read -r b
@@ -13,7 +14,7 @@ read -r b
 if [ $t -le 20 -o $b -ge 30 ]; then
 echo "Statement is True"
 else
-echo "Flase, Statement Try Again."
+echo "False Statement, Try Again."
 fi
 
 # END #
diff --git a/userexists.sh b/userexists.sh
index da5e3c2..1b8dde7 100644
--- a/userexists.sh
+++ b/userexists.sh
@@ -5,7 +5,7 @@
 ##WebSite: https://arkit.co.in
 
 ##Start
-echo "Please Enter User name you want check:\c"
+echo -e "Please Enter User name you want check: \c"
 read user
 grep $user /etc/passwd > /dev/null
 if [ $? -eq 0 ]; then
diff --git a/variables.sh b/variables.sh
index 7d765aa..7f3128d 100644
--- a/variables.sh
+++ b/variables.sh
@@ -6,6 +6,7 @@
 #website: https://arkit.co.in
 #Author: Ankam Ravi Kumar
 # START #
+
 A=10
 Ba=23
 BA=45

From 9e1a1da2c6376a4f08b246e44d331e21c6e9fe87 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Fri, 7 Jan 2022 13:22:03 +0530
Subject: [PATCH 09/24] Create memusage.sh

---
 memusage.sh | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 memusage.sh

diff --git a/memusage.sh b/memusage.sh
new file mode 100644
index 0000000..45187ca
--- /dev/null
+++ b/memusage.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+## Monitoring Memory usage of the server
+# Version:1.0
+# Created Date: 2022-Jan-07
+# WebSite: https://arkit.co.in
+# Author: Ankam Ravi Kumar
+
+HOSTNAME=$(hostname)
+DATED=$(date "+%Y-%m-%d %H:%M:%S")
+THRESHOLD=80
+TOADDRESS=aravikumar48@gmail.com
+
+MEMUSAGE=$(free | grep Mem | awk '{print $3/$2 * 100.0}' |awk -F. '{print $1}')
+if [ $MEMUSAGE -ge $THRESHOLD ]; then
+echo "$HOSTNAME, $DATED, %MEMUSAGE" >> /var/log/memusage_history
+echo "$HOSTNAME, $DATED, %MEMUSAGE" > /tmp/memusage
+mail -s "$HOSTNAME $DATED Mem Usage: $MEMUSAGE" $TOADDRESS <<< /tmp/memusage
+fi

From 68f15e770455f6fba4e953d74c867ae5116941e9 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Mon, 10 Oct 2022 16:48:55 +0530
Subject: [PATCH 10/24] Create convert_and_update_mysql.sh

---
 convert_and_update_mysql.sh | 42 +++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 convert_and_update_mysql.sh

diff --git a/convert_and_update_mysql.sh b/convert_and_update_mysql.sh
new file mode 100644
index 0000000..0a6436d
--- /dev/null
+++ b/convert_and_update_mysql.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+n=1
+until [ $n -gt 11196 ]
+do
+EXIRECORDS=$(mysql -u root -pmysql -h 192.168.2.100 -e "SELECT sn,tarsize from DATABASE.Table1 where sn='"$n"'" |tail -n1 |grep $n)
+
+RECORDNUMBER=$(echo $EXIRECORDS |awk '{print $1}')
+FOLDERSIZE=$(echo $EXIRECORDS |awk '{print $2}')
+
+KB=$(echo $EXIRECORDS |awk '{print $2}' |grep K |wc -l)
+        if [ $KB -ge 1 ]; then
+                K=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/K//g')
+                BYTES=$($K * 1024 |bc |awk -F. '{print $1}')
+                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+        fi
+
+MB=$(echo $EXIRECORDS |awk '{print $2}' |grep M |wc -l)
+        if [ $MB -ge 1 ]; then
+                M=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/M//g')
+                BYTES=$(echo $M*1024*1024 |bc |awk -F. '{print $1}')
+                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+        fi
+
+GB=$(echo $EXIRECORDS |awk '{print $2}' |grep G |wc -l)
+        if [ $GB -ge 1 ]; then
+                G=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/G//g')
+                BYTES=$(echo $G*1024*1024*1024 |bc |awk -F. '{print $1}')
+                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+        fi
+
+TB=$(echo $EXIRECORDS |awk '{print $2}' |grep T |wc -l)
+        if [ $TB -ge 1 ]; then
+                T=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/T//g')
+                BYTES=$(echo $T*1024*1024*1024*1024 |bc |awk -F. '{print $1}')
+                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+        fi
+
+
+n=`expr "$n" + 1`
+
+done

From d8d9a82c7d5762ae1903d21a433ea743cf9e55d1 Mon Sep 17 00:00:00 2001
From: Jessica Lee <jlee1290@terpmail.umd.edu>
Date: Sun, 27 Nov 2022 02:20:15 -0500
Subject: [PATCH 11/24] Add regex example

---
 regex.sh | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100755 regex.sh

diff --git a/regex.sh b/regex.sh
new file mode 100755
index 0000000..62f2445
--- /dev/null
+++ b/regex.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#Purpose: regex examples
+#Version:1.0
+#Create Date:
+#Modified Date:
+
+# START #
+
+numString1="1234"
+numString2="16789"
+numString3="1579"
+
+
+echo "Example 1"
+if [[ $numString1 =~ ^1 ]]; then
+	echo "String \"$numString1\" starts with a \"1\", and matches regex: ^1"
+fi
+
+echo "Example 2"
+if [[ $numString2 =~ ^1 ]]; then
+        echo "String \"$numString2\" starts with a \"1\", and matches regex: ^1"
+fi
+
+echo "Example 3"
+if [[ $numString3 =~ ^1.7 ]]; then
+        echo "String \"$numString2\" starts with a \"1\", followed by any character, and followed by a 7. "
+        echo "This string matches the regex: ^1.7"
+fi
+
+echo "Example 4"
+if [[ ! $numString1 =~ ^1.7 ]]; then
+        echo "String \"$numString1\" does not start with a \"1\", followed by any character, and followed by a 7. "
+        echo "This string does not match the regex: ^1.7"
+fi
+
+echo "Example 5"
+if [[ $numString2 =~ 9$ ]]; then
+	echo "String \"$numString2\" ends with a \"9\", and matches the regex: 9$"
+fi
+

From 332cb67716506bcc7637248d29fe96e22641df97 Mon Sep 17 00:00:00 2001
From: jlee882 <87512552+jlee882@users.noreply.github.com>
Date: Sun, 27 Nov 2022 02:28:35 -0500
Subject: [PATCH 12/24] Update regex.sh

---
 regex.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/regex.sh b/regex.sh
index 62f2445..376bb77 100755
--- a/regex.sh
+++ b/regex.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #Purpose: regex examples
-#Version:1.0
-#Create Date:
+#Version: 1.0
+#Create Date: Sun Nov 27 00:27:33 EST 2022
 #Modified Date:
 
 # START #

From 1cd679ad7fa03823456567833797a5f3b0cea9c8 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 13 Jul 2023 15:32:54 +0530
Subject: [PATCH 13/24] Create serverinformation.sh

Collect Linux Server information
---
 serverinformation.sh | 104 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 serverinformation.sh

diff --git a/serverinformation.sh b/serverinformation.sh
new file mode 100644
index 0000000..c63a43a
--- /dev/null
+++ b/serverinformation.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+mkdir -p /Inventory
+sudo chmod -R 777 /Inventory/
+mkdir -p /tmp/asset
+touch /tmp/asset/`hostname`.txt
+touch /tmp/temptext
+TEMP=/tmp/temptext
+LOG=`ls /tmp/asset/*.txt`
+echo "## Host Information" > $LOG
+echo "Host Name : `hostname` " >> $LOG
+echo "`sudo /sbin/ifconfig -a |grep "inet" | awk 'BEGIN { FS = ":" } ; { print $2 }'`" >> $TEMP
+echo "IP Address : `egrep '^10' $TEMP |awk '{ print $1}'`" >> $LOG
+echo "IP Address: `hostname -I`" >> $LOG
+echo "ip a |grep inet |grep -v "::" |awk '{print $2}'" >> $LOG
+echo "iDrac Details: `racadm getniccfg |grep "IP Address" |grep -v "::"`" >> $LOG
+echo "Server Type: `servertype=$(lscpu | grep Hypervisor | wc -l); if [ $servertype -gt 0 ]; then echo "VitualMachine"; else echo "Physical"; fi`" >> $LOG
+echo -en '\n' >> $LOG
+
+## Collecting Hardware Details ##
+echo " " >> $LOG
+echo "## Hardware Information" >> $LOG
+echo " " >> $LOG
+echo "Serial Number     : `sudo lshal |grep system.hardware.serial`" >> $LOG
+echo "Serial Number     : `sudo /usr/sbin/dmidecode -s system-serial-number`" >> $LOG
+echo "Serial Number     : `sudo cat /sys/class/dmi/id/product_serial`" >> $LOG
+echo "Model Number      : `sudo lshal |grep system.hardware.product`" >> $LOG
+echo "Model Number      : `sudo /usr/sbin/dmidecode |grep "SKU Number"`" >> $LOG
+echo "Model Number      : `sudo cat /sys/class/dmi/id/product_name`" >> $LOG
+echo "Hardware Vendor   : `sudo lshal |grep system.hardware.vendor`" >> $LOG
+echo "Hardware Vendor   : `sudo cat /sys/class/dmi/id/chassis_vendor`" >> $LOG
+echo "Hardware Info     : `sudo dmesg |grep DMI`" >> $LOG
+
+## Redhat Version ##
+echo " " >> $LOG
+echo "## OS Version" >> $LOG
+head -n1 /etc/issue >> $LOG
+cat /etc/redhat-release >> $LOG
+echo "Kernel Version: `uname -r`">> $LOG
+echo "OS Version: `hostnamectl | egrep "Operating System" | cut -d ' ' -f5-`" >> $LOG
+
+## CPU Info ##
+echo " " >> $LOG
+echo " " >> $LOG
+echo "## CPU Information" >> $LOG
+grep "model name" /proc/cpuinfo |uniq >> $LOG
+COUNTT=$(cat /proc/cpuinfo |grep "model name" | wc -l)
+echo "$COUNTT Cores" >> $LOG
+
+## RAM/MEMORY Info ##
+echo " " >> $LOG
+echo " " >> $LOG
+echo "## Memory Information" >> $LOG
+grep MemTotal /proc/meminfo >> $LOG
+y=`grep MemTotal /proc/meminfo |awk '{ print $2 }'`
+mb="$(( $y / 1024 ))"
+gb="$(( $mb / 1024 ))"
+echo "RAM : $gb GB" >> $LOG
+
+## Swap Information ##
+echo " " >> $LOG
+echo "## Swap Information" >> $LOG
+y1=$(free -k |grep Swap |awk '{print $2}')
+mb1="$(( $y1 / 1024 ))"
+gb1="$(( $mb1 / 1024 ))"
+echo "Swap Size: $gb1 GB" >> $LOG
+
+## Disk Information ##
+echo " " >> $LOG
+echo "## Disk Information" >> $LOG
+lsblk |grep -E 'part|disk' $LOG
+
+## LVM Information ##
+echo " " >> $LOG
+echo "## Physical Volumes" >> $LOG
+pvs >> $LOG
+
+echo " " >> $LOG
+echo "## Volume Groups" >> $LOG
+vgs >> $LOG
+
+echo " " >> $LOG
+echo "## Logical Volumes" >> $LOG
+lvs >> $LOG
+echo " " >> $LOG
+
+## Partition Information ##
+echo "## DF Command Output" >> $LOG
+echo " " >> $LOG
+df -Ph -x tmpfs -x devtmpfs| sed s/%//g | awk '{ if($5 > 0) print $0;}' >> $LOG
+
+echo " " >> $LOG
+echo "## Port Information" >> $LOG
+ss -alntup |column -t |grep -E 'tcp|udp' >> $LOG
+
+echo " " >> $LOG
+echo "## Service Information" >> $LOG
+systemctl list-units --type=service --state=active |grep -vE 'systemd|selinux' >> $LOG
+
+echo " " >> $LOG
+echo "## Docker Containers" >> $LOG
+sudo docker ps -a >> $LOG
+
+sudo cp /tmp/asset/`hostname`.txt /Inventory/`hostname`-`date "+%Y-%m-%d"`.txt

From 87ae2a854444a359e11218e589eff1454e371a27 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 13 Jul 2023 15:35:14 +0530
Subject: [PATCH 14/24] Update CpuMemDisk.sh

---
 CpuMemDisk.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CpuMemDisk.sh b/CpuMemDisk.sh
index 8e986ae..441fe0c 100644
--- a/CpuMemDisk.sh
+++ b/CpuMemDisk.sh
@@ -4,7 +4,7 @@
 # Version:1.0
 # Created Date: 2019-05-02
 # Modified Date:
-# WebSite: https://server-computer.com
+# WebSite: https://arkit.co.in
 # Author: Ankam Ravi Kumar
 
 HOSTNAME=$(hostname)

From 33839affdaefab50bc894eaee0661d66f7239a8f Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 13 Jul 2023 15:38:24 +0530
Subject: [PATCH 15/24] Update convert_and_update_mysql.sh

---
 convert_and_update_mysql.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/convert_and_update_mysql.sh b/convert_and_update_mysql.sh
index 0a6436d..98f4d25 100644
--- a/convert_and_update_mysql.sh
+++ b/convert_and_update_mysql.sh
@@ -3,7 +3,7 @@
 n=1
 until [ $n -gt 11196 ]
 do
-EXIRECORDS=$(mysql -u root -pmysql -h 192.168.2.100 -e "SELECT sn,tarsize from DATABASE.Table1 where sn='"$n"'" |tail -n1 |grep $n)
+EXIRECORDS=$(mysql -u root -pPASSWORD -h 192.168.2.100 -e "SELECT sn,tarsize from DATABASE.Table1 where sn='"$n"'" |tail -n1 |grep $n)
 
 RECORDNUMBER=$(echo $EXIRECORDS |awk '{print $1}')
 FOLDERSIZE=$(echo $EXIRECORDS |awk '{print $2}')
@@ -12,28 +12,28 @@ KB=$(echo $EXIRECORDS |awk '{print $2}' |grep K |wc -l)
         if [ $KB -ge 1 ]; then
                 K=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/K//g')
                 BYTES=$($K * 1024 |bc |awk -F. '{print $1}')
-                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+                mysql -u root -pPASSWORD -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
         fi
 
 MB=$(echo $EXIRECORDS |awk '{print $2}' |grep M |wc -l)
         if [ $MB -ge 1 ]; then
                 M=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/M//g')
                 BYTES=$(echo $M*1024*1024 |bc |awk -F. '{print $1}')
-                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+                mysql -u root -pPASSWORD -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
         fi
 
 GB=$(echo $EXIRECORDS |awk '{print $2}' |grep G |wc -l)
         if [ $GB -ge 1 ]; then
                 G=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/G//g')
                 BYTES=$(echo $G*1024*1024*1024 |bc |awk -F. '{print $1}')
-                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+                mysql -u root -pPASSWORD -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
         fi
 
 TB=$(echo $EXIRECORDS |awk '{print $2}' |grep T |wc -l)
         if [ $TB -ge 1 ]; then
                 T=$(echo $EXIRECORDS |awk '{print $2}' |sed 's/T//g')
                 BYTES=$(echo $T*1024*1024*1024*1024 |bc |awk -F. '{print $1}')
-                mysql -u root -pmysql -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
+                mysql -u root -pPASSWORD -h 192.168.2.100 -e "UPDATE DATABASE.Table1 SET tarsize='"$BYTES"' where sn='"$RECORDNUMBER"'"
         fi
 
 

From 73dfba05386a78fa8b7ce8c1fa00d52116bffa1e Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 13 Jul 2023 16:15:39 +0530
Subject: [PATCH 16/24] Update serverinformation.sh

---
 serverinformation.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/serverinformation.sh b/serverinformation.sh
index c63a43a..ed269c8 100644
--- a/serverinformation.sh
+++ b/serverinformation.sh
@@ -95,7 +95,7 @@ ss -alntup |column -t |grep -E 'tcp|udp' >> $LOG
 
 echo " " >> $LOG
 echo "## Service Information" >> $LOG
-systemctl list-units --type=service --state=active |grep -vE 'systemd|selinux' >> $LOG
+systemctl list-units --type=service --state=running |grep -vE 'systemd|selinux' >> $LOG
 
 echo " " >> $LOG
 echo "## Docker Containers" >> $LOG

From 28b212487a471fa7801969c469c17619aacaf996 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Thu, 13 Jul 2023 16:20:27 +0530
Subject: [PATCH 17/24] Update serverinformation.sh

---
 serverinformation.sh | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/serverinformation.sh b/serverinformation.sh
index ed269c8..221e037 100644
--- a/serverinformation.sh
+++ b/serverinformation.sh
@@ -101,4 +101,12 @@ echo " " >> $LOG
 echo "## Docker Containers" >> $LOG
 sudo docker ps -a >> $LOG
 
+echo " " >> $LOG
+echo "## DNS Server Details" >> $LOG
+cat /etc/resolv.conf >> $LOG
+
+echo "" >> $LOG
+echo "## Server Uptime" >> $LOG
+uptime >> $LOG
+
 sudo cp /tmp/asset/`hostname`.txt /Inventory/`hostname`-`date "+%Y-%m-%d"`.txt

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 18/24] 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

From c549aad384d076d6eec6a9b074f99beb76ffd5a6 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Mon, 9 Oct 2023 18:39:23 +0530
Subject: [PATCH 19/24] Added diskover-2.1.1.zip

diskover-2.1.1.zip
---
 diskover-2.1.1.zip | Bin 0 -> 3434071 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 diskover-2.1.1.zip

diff --git a/diskover-2.1.1.zip b/diskover-2.1.1.zip
new file mode 100644
index 0000000000000000000000000000000000000000..8bf687fc6f45d68868c00e9410fe60ae70926bcc
GIT binary patch

From ab5561a896a46cb416912aea0a7d93238452985a Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Sat, 21 Sep 2024 00:39:29 +0530
Subject: [PATCH 20/24] Create useradd_improved.sh

---
 useradd_improved.sh | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 useradd_improved.sh

diff --git a/useradd_improved.sh b/useradd_improved.sh
new file mode 100644
index 0000000..d41a150
--- /dev/null
+++ b/useradd_improved.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+## Author: Ankam Ravi Kumar
+## Date: 21st Sep 2024
+## Purpose: To Create a users in Linux
+
+check_command_success() {
+	if [ $? -ne 0 ]; then
+		echo "Error: $1"
+		exit 1
+	fi
+}
+
+if [ $(id -u) -ne 0 ]; then
+	echo "Error: Only root may add a user to the system."
+	exit 2
+fi
+
+# Prompt for the username and password
+read -p "Enter username: " username
+read -s -p "Enter password: " password
+echo
+
+if id "$username" &>/dev/null; then
+	echo "Error: User '$username' already exists!"
+	exit 1
+fi
+
+encrypted_password=$(perl -e 'print crypt($ARGV[0], "password")' "$password")
+check_command_success "Failed to encrypt the password."
+
+useradd -m -p "$encrypted_password" "$username"
+check_command_success "Failed to add the user."
+
+passwd -e "$username"
+check_command_success "Failed to set password expiry."
+
+echo "Success: User '$username' has been added to the system!"

From fc1581324bd5354a519c9d2b6d7ef6b4107f1e57 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Sat, 21 Sep 2024 00:43:28 +0530
Subject: [PATCH 21/24] Update and rename 1forloop.sh to forloop.sh

---
 1forloop.sh => forloop.sh | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename 1forloop.sh => forloop.sh (100%)

diff --git a/1forloop.sh b/forloop.sh
similarity index 100%
rename from 1forloop.sh
rename to forloop.sh

From 1d5a7e94529c65bd632da675eb74b8ff5f9e0f64 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Sat, 21 Sep 2024 00:44:20 +0530
Subject: [PATCH 22/24] Update and rename 1function.sh to function.sh

---
 1function.sh => function.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
 rename 1function.sh => function.sh (92%)

diff --git a/1function.sh b/function.sh
similarity index 92%
rename from 1function.sh
rename to function.sh
index dc12048..48dbf17 100644
--- a/1function.sh
+++ b/function.sh
@@ -1,10 +1,11 @@
 #!/bin/bash
 #Purpose: Function example. Taking Backup of Particular File
 #Version:1.0
-#Created Date: Sat May 26 00:27:50 IST 2018
+#Created Date: 2024 Sep 21
 #Modified Date:
 #WebSite: https://arkit.co.in
 #Author: Ankam Ravi Kumar
+
 # START #
 function takebackup (){
         if [ -f $1 ]; then

From 4e4d2e588bfc335f24ae8f98322b1e1190c6f3d2 Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Sat, 21 Sep 2024 00:45:27 +0530
Subject: [PATCH 23/24] Update and rename arkit.co.in-nested-if.sh to
 ExamResults.sh

---
 arkit.co.in-nested-if.sh => ExamResults.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename arkit.co.in-nested-if.sh => ExamResults.sh (94%)

diff --git a/arkit.co.in-nested-if.sh b/ExamResults.sh
similarity index 94%
rename from arkit.co.in-nested-if.sh
rename to ExamResults.sh
index 17d421b..b718bdf 100644
--- a/arkit.co.in-nested-if.sh
+++ b/ExamResults.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 #Purpose: Validate and report Student subject marks
 #Version:1.0
-#Created Date: Wed May 16 19:00:52 IST 2018
+#Created Date: 2024 sep
 #Modified Date:
 #Author: Ankam Ravi Kumar
 # START #

From 883ab3df25ae5d929e32c46da0969f18dde9c80b Mon Sep 17 00:00:00 2001
From: Ankam Ravi Kumar <14858025+techarkit@users.noreply.github.com>
Date: Sat, 21 Sep 2024 00:48:11 +0530
Subject: [PATCH 24/24] Create Even_or_Odd_Number.sh

---
 Even_or_Odd_Number.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 Even_or_Odd_Number.sh

diff --git a/Even_or_Odd_Number.sh b/Even_or_Odd_Number.sh
new file mode 100644
index 0000000..a8294a1
--- /dev/null
+++ b/Even_or_Odd_Number.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+## To find given number is Even number or Odd Number
+
+read -p "Enter a number: " number
+
+if [ $((number % 2)) -eq 0 ]; then
+    echo "$number is an even number."
+else
+    echo "$number is an odd number."
+fi
