Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
irul
/
tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit dd5fd5d3
authored
Sep 07, 2020
by
irul
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add new file
0 parents
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
0 deletions
server_info.sh
server_info.sh
0 → 100644
View file @
dd5fd5d
#!/bin/bash
# irul@20200907
clear
# https://www.2daygeek.com/bash-shell-script-view-linux-system-information/
echo
-e
"--System Information--"
echo
-e
"Manufacturer: "
`
cat /sys/class/dmi/id/chassis_vendor
`
echo
-e
"Product Name: "
`
cat /sys/class/dmi/id/product_name
`
echo
-e
"Version: "
`
cat /sys/class/dmi/id/product_version
`
echo
-e
"Serial Number: "
`
cat /sys/class/dmi/id/product_serial
`
echo
-e
"Machine Type: "
`
vserver
=
$(
lscpu | grep Hypervisor | wc -l
)
;
if
[
$vserver
-gt 0
]
;
then
echo
"VM"
;
else
echo
"Physical"
;
fi
`
echo
-e
"Kernel: "
`
uname -r
`
echo
-e
"Architecture: "
`
arch
`
echo
-e
"Processor Name: "
`
awk -F
':'
'/^model name/ {print $2}'
/proc/cpuinfo | uniq | sed -e
's/^[ \t]*//'
`
echo
""
echo
-e
"HDD: "
`
lsblk -dio SIZE,KNAME,MODEL,TYPE | grep disk
`
echo
-e
"Memory(RAM): "
`
free -mht| awk
'/Mem/{print $2 " |Used: " $3 " |Free: " $4}'
`
echo
-e
"Swap Memory: "
`
free -mht| awk
'/Swap/{print $2 " |Used: " $3 " |Free: " $4}'
`
echo
""
# echo -e "Operating System: "`hostnamectl | grep "Operating System" | cut -d ' ' -f5-`;
echo
-e
"Operating System: "
`
cat /etc/
*
release | grep PRETTY_NAME | cut -d
"="
-f 2 | tr -d
'"'
`
echo
-e
"Using Systemd: "
`
pidof systemd
&&
echo
"True"
||
echo
"False"
`
echo
-e
"Hostname: "
`
hostname
`
echo
-e
"Server IP: "
`
hostname -I
`
echo
-e
"Uptime: "
`
uptime | awk
'{print $3,$4}'
| sed
's/,//'
`
echo
""
echo
-e
"--Base Application--"
# virtualmin
if
command
-v virtualmin &> /dev/null
then
echo
"[x] virtualmin-"
$(
dpkg -l virtualmin-custom | grep ^ii | awk
'{print $3}'
| cut -f1 -d-
)
else
echo
"[_] virtualmin"
fi
# webmin
if
dpkg --get-selections | grep webmin &> /dev/null
then
echo
"[x] webmin-"
$(
dpkg -l webmin | grep ^ii | awk
'{print $3}'
| cut -f1 -d-
)
else
echo
"[_] webmin"
fi
# openvpn
if
command
-v openvpn &> /dev/null
then
echo
"[x] openvpn-"
$(
openvpn --version | head -n 1 | cut -d
" "
-f 2
)
else
echo
"[_] openvpn"
fi
# git
if
command
-v git &> /dev/null
then
echo
"[x] git-"
$(
git --version | head -n 1 | cut -d
" "
-f 3
)
else
echo
"[_] git"
fi
# apache2
if
dpkg --get-selections | grep -E
'(^|\s)apache2($|\s)'
&> /dev/null
then
echo
"[x] apache2-"
$(
dpkg -l apache2 | grep ^ii | awk
'{print $3}'
| cut -f1 -d-
)
else
echo
"[_] apache2"
fi
# nginx
if
dpkg --get-selections | grep nginx &> /dev/null
then
echo
"[x] nginx-"
$(
dpkg -l nginx | grep ^ii | awk
'{print $3}'
| cut -f1 -d-
)
else
echo
"[_] nginx"
fi
# postgresql
if
command
-v psql &> /dev/null
then
echo
"[x] postgresql-"
$(
psql -V | head -n 1 | cut -d
" "
-f 3
)
else
echo
"[_] postgresql"
fi
# mysql
if
command
-v mysql &> /dev/null
then
echo
"[x] mysql-"
$(
dpkg -l mysql-server | grep ^ii | awk
'{print $3}'
| cut -f1 -d-
)
else
echo
"[_] mysql"
fi
# python3
if
command
-v python3 &> /dev/null
then
echo
"[x] python3-"
$(
python3 --version | head -n 1 | cut -d
" "
-f 2
)
else
echo
"[_] python3"
fi
# php
if
command
-v php &> /dev/null
then
echo
"[x] php-"
$(
php -v | head -n 1 | cut -d
" "
-f 2
)
else
echo
"[_] php"
fi
echo
""
echo
"Last Check: "
$(
date
'+%Y-%m-%d'
)
echo
""
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment