Compare commits
501 Commits
master.syn
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 48543af2ab | |||
| 8293f5c277 | |||
| f1cca3b3f3 | |||
| 28f57b2e51 | |||
| b4ad1ecdc1 | |||
| b08342b13d | |||
| 815cb3a82c | |||
| eedbf336fb | |||
| 73fe73e6f7 | |||
| 5773f1d8ee | |||
| 3c9ab587a4 | |||
| 4726de436c | |||
| 56bc9d890c | |||
| 0dfc0c9ce7 | |||
| 3f3ebf1b51 | |||
| a30dcc2d65 | |||
| 4d4abe2edc | |||
| 7333e21441 | |||
| 364540bfba | |||
| 3e08621d9a | |||
| 6a71b855c3 | |||
| f0ea6186e6 | |||
| d1a591926a | |||
| 4f3497913a | |||
| 0d61de9938 | |||
| 8221e90edd | |||
| e7cf89025e | |||
| f27c16301d | |||
| 4548618348 | |||
| dd6ed1144c | |||
| 0166100b19 | |||
| 5766bce649 | |||
| ffae1ba0bc | |||
| a7814ee165 | |||
| a3293c2a9f | |||
| 8820b8101b | |||
| c6ffae9fcc | |||
| 798c52381a | |||
| 2e8db34a28 | |||
| a0b4479465 | |||
| 4302e8510a | |||
| 936170c65f | |||
| 69ea24a8ee | |||
| e7306660ec | |||
| bfc9da64a6 | |||
| b27bc2cb51 | |||
| 7e0919f703 | |||
| 5653d242c0 | |||
| c9f609746c | |||
| 05aace9993 | |||
| 5b69a8e134 | |||
| 62263159ab | |||
| 3cf7de7f9d | |||
| 7d5d972b67 | |||
| d0af695d3f | |||
| 6629fe272e | |||
| e84957e4e6 | |||
| 74c260647d | |||
| b4a73535c5 | |||
| 600b1efa1c | |||
| 990651b384 | |||
| 8f2555ae25 | |||
| 7cc0323013 | |||
| f779d0ae23 | |||
| 0cecfd1ecd | |||
| b813aaeae4 | |||
| 853637bb6a | |||
| 2df1720d50 | |||
| 48f85a8e56 | |||
| 9473142809 | |||
| 790bf59f18 | |||
| 81145a8f2d | |||
| 18582cd766 | |||
| 04f08bad45 | |||
| 3f6b246495 | |||
| f21037a510 | |||
| 92bf3e46f9 | |||
| 8477b07833 | |||
| 83907da04c | |||
| 4eb3769226 | |||
| fa47f1d57d | |||
| dcbff599eb | |||
| 1ea8462a8e | |||
| 4548470a12 | |||
| 23f23b0da8 | |||
| 241d4f3e61 | |||
| f22208ff9e | |||
| 33f02ffc40 | |||
| 70cd06d839 | |||
| 8b9e3c9332 | |||
| 06f7147002 | |||
| 6e68530ead | |||
| 228810e6d2 | |||
| 41ef99ebd1 | |||
| 890e915071 | |||
| 99d89baeeb | |||
| c1797c38ea | |||
| 1057c688ea | |||
| cb3acd2633 | |||
| 6bda96c9d5 | |||
| 90e4435d09 | |||
| ef60933f7e | |||
| 3bee3b350d | |||
| b064041625 | |||
| 54e1717582 | |||
| 869d88ee50 | |||
| e23e4b9d1d | |||
| f10c181fff | |||
| 985bf50b93 | |||
| 794c2ce9c3 | |||
| 6ec545ede0 | |||
| 93e8855711 | |||
| 628be22d8e | |||
| fde5c969e9 | |||
| e50dc9d352 | |||
| 6948cf0805 | |||
| 42ac2c5435 | |||
| 6774871164 | |||
| f377aaf641 | |||
| 1449076039 | |||
| 86649b61fe | |||
| bc8e01e6de | |||
| d589905cca | |||
| 3cb3ae9d23 | |||
| 8071e09748 | |||
| af9e153c3d | |||
| 1f8833c70c | |||
| 91c73ee8e1 | |||
| bb58abce6d | |||
| 4a1943bb0b | |||
| 228fd090b2 | |||
| f72f4cd281 | |||
| 955cc7595d | |||
| 7d11e714ba | |||
| a856dc70dc | |||
| 01f2f1ef3e | |||
| 68cd8bf98f | |||
| ceeece94b1 | |||
| 1801d00f23 | |||
| f74540a7e2 | |||
| 9fbe802f7e | |||
| baa58397d2 | |||
| 92627abe49 | |||
| d9ecb12fc1 | |||
| f1c8839553 | |||
| 43bf8c6947 | |||
| 1c6fcd6472 | |||
| 9b2da6e26a | |||
| 83eadf6751 | |||
| d0c083faa1 | |||
| f4b85df3b6 | |||
| f7d6e8b299 | |||
| dc2f8c232b | |||
| 2a2292a523 | |||
| bfb29ffe00 | |||
| 3cdd5e5567 | |||
| 71f8160f0c | |||
| b27d7b3291 | |||
| 38b47ee522 | |||
| ac91fce34b | |||
| af1d7fcac4 | |||
| c38e7eb865 | |||
| 99f2eb79f3 | |||
| b28a16c803 | |||
| f10b7eefdc | |||
| 9732758922 | |||
| b7fd12fca5 | |||
| 23694826fa | |||
| 9da59a143e | |||
| ed91f828db | |||
| f5ec6a5ba3 | |||
| 3d0756c3e9 | |||
| 30f40eadf2 | |||
| 847fcd3bb5 | |||
| d3e616e72c | |||
| 6536ac149e | |||
| 9dbdba7ac5 | |||
| b6ee894722 | |||
| 9dd25bbed1 | |||
| 2b5191360e | |||
| 7d193e67f9 | |||
| a06a6efe79 | |||
| 365990b99d | |||
| 50dfe3a0b6 | |||
| 5a2c087fae | |||
| 50ac70fa25 | |||
| 692a39c816 | |||
| 52abe55297 | |||
| 6cbe38c3d4 | |||
| 302e12861f | |||
| bbbee04352 | |||
| dc37689a60 | |||
| 790dddf3de | |||
| ac68e5720d | |||
| 469cb15622 | |||
| 517bbd4f9b | |||
| ac36fb66a1 | |||
| 4c62038e7d | |||
| 8eb62e8b3a | |||
| 6914795d9c | |||
| 5daac11745 | |||
| 106a50bb85 | |||
| 24de4f5a23 | |||
| 5b338074b1 | |||
| 6d9074300f | |||
| 04f17dfad6 | |||
| 968beb9fdc | |||
| a5b363cabe | |||
| 6538bfe1b0 | |||
| 2c32cfc4e2 | |||
| b19706ff87 | |||
| 95e972970f | |||
| 28e67cfae8 | |||
| 2bdadf347c | |||
| 1d1e7cbcf9 | |||
| 1229bb103a | |||
| 5ea2d4ed70 | |||
| 0f1b2c02c1 | |||
| 44e96ccfd0 | |||
| 355f03a9a4 | |||
| 401076b37b | |||
| 3b4af9fba9 | |||
| 10ef8c3522 | |||
| 94fd2cfb52 | |||
| 7fae62ca9c | |||
| 7febc7ade9 | |||
| 482b809252 | |||
| 489eb29149 | |||
| b4cff0fb6c | |||
| dab22bc597 | |||
| c9adfa65c2 | |||
| ec32304618 | |||
| f769509e19 | |||
| dff351e324 | |||
| b106895b7e | |||
| eac5d8daac | |||
| 41161de924 | |||
| 614871c20e | |||
| 94fc039338 | |||
| 309dc2ca0a | |||
| 0be8368ed3 | |||
| 728a85c984 | |||
| 4687dbc15a | |||
| 86b309e1b6 | |||
| 0847dbeeca | |||
| f33ced8382 | |||
| 0ab606da6a | |||
| 06c78a1e74 | |||
| 25f64caf06 | |||
| c0f61df10d | |||
| ffa272c38b | |||
| 59d79e2bb2 | |||
| 4c51be9de1 | |||
| cc7ec0d0aa | |||
| 4c4844e410 | |||
| 2e930ac6f1 | |||
| 6474d57b43 | |||
| a83ec2f4d6 | |||
| 2a9fcc0414 | |||
| 9e52073a56 | |||
| 641ca2e947 | |||
| 9b3bee9ad1 | |||
| dfdf9ae8b3 | |||
| da4800026b | |||
| 41d5ac88f4 | |||
| 7e3e682c10 | |||
| 10acd5646e | |||
| ae87c9b6c6 | |||
| 43b2fe9bf5 | |||
| 8e79849815 | |||
| f0a0a8fcb4 | |||
| 421afc3fb5 | |||
| 1b119f1492 | |||
| 38e6d2e2f5 | |||
| f288bbc475 | |||
| 6b64c74522 | |||
| 8d12d5d868 | |||
| 44cb351722 | |||
| 6b5c1f4ab6 | |||
| 895e83dad2 | |||
| 1df6104f11 | |||
| 181dd3ae28 | |||
| 8e3ad35df9 | |||
| da15b29645 | |||
| 11bd3eef15 | |||
| a55720851a | |||
| aebe8cee9d | |||
| 3c7f74b993 | |||
| eef4a62ede | |||
| 82c08faa7d | |||
| 61fbd3cd91 | |||
| ef1a4a994f | |||
| cb02aa0716 | |||
| 3251bba28e | |||
| a82109a335 | |||
| c79d63131c | |||
| 782145ce24 | |||
| dd387ee558 | |||
| 56776f5644 | |||
| 45eccc7837 | |||
| e8500c4869 | |||
| b4b36bb949 | |||
| 0418bdfd7c | |||
| bf10b5bab3 | |||
| 71b8b977d8 | |||
| 38fc82cefe | |||
| d4364e1e77 | |||
| f9dac98a80 | |||
| 14f8ed7200 | |||
| 8f11e3adf8 | |||
| e5398ebea3 | |||
| c4c3dab3e3 | |||
| 1f917d4cd9 | |||
| 1d7ffe62a5 | |||
| e42c823755 | |||
| f53838ce03 | |||
| f0857c8593 | |||
| de026d059a | |||
| 63b71cf36b | |||
| cfc7eb4ed6 | |||
| 85ddbc7cf4 | |||
| 7ca613aa39 | |||
| 8212b1e494 | |||
| 8908bf215c | |||
| a9cdb3bce4 | |||
| ede5fc5c70 | |||
| 5cfee79413 | |||
| 766ab471ce | |||
| 7776548d61 | |||
| 910b773864 | |||
| daa4971bc6 | |||
| a7c0dcd3c8 | |||
| 0cc0d812ad | |||
| bb06fde172 | |||
| c2feeb73aa | |||
| 53d95e84bb | |||
| 421a1e514e | |||
| 2ebfca4429 | |||
| 6bd2580ad2 | |||
| c629a23fd3 | |||
| 715f3a66fc | |||
| a410fb4f82 | |||
| 9648baf92e | |||
| 272eb10e27 | |||
| 95b0f4b14e | |||
| 74b706ad99 | |||
| 348e165f68 | |||
| ff4d145e23 | |||
| 13e1320c0a | |||
| 43f06b8f1d | |||
| 5169a53865 | |||
| a9c387b695 | |||
| 7c33de0270 | |||
| 973e682abd | |||
| 62ff07f952 | |||
| 4a49eb3e8d | |||
| f8a1125f6f | |||
| b0b5b5669c | |||
| 5e64ae6c43 | |||
| 3bf718b244 | |||
| 2df0bc68d1 | |||
| 2a5b08ee1d | |||
| d08e9716a3 | |||
| 73f6bf3f59 | |||
| 1073e05535 | |||
| 057d01c425 | |||
| b2b666df8b | |||
| b107168f8c | |||
| 1c033daa60 | |||
| 1b4ab2e326 | |||
| 12d89d6187 | |||
| b98d2b2c4a | |||
| 04619f9b87 | |||
| 8d928fa74e | |||
| e5b909b003 | |||
| c92a539e63 | |||
| b455b16fdc | |||
| 403fe3c7b7 | |||
| 6e0de2060e | |||
| c9df156c21 | |||
| 7a917cd031 | |||
| b2b7731f2c | |||
| 7a422bdd63 | |||
| 8cfe984bd2 | |||
| 0bd40d9c9b | |||
| f88c11ca1a | |||
| b8e7a3a9fc | |||
| bb7ca58d79 | |||
| 2477748494 | |||
| bf63afe3f9 | |||
| 4701ecfb77 | |||
| e816657943 | |||
| d687d855eb | |||
| ed61592f2a | |||
| 411e6b2e8a | |||
| a5ae3b4ef1 | |||
| e4c9c82912 | |||
| 6ff8de6a47 | |||
| 0db8cd2488 | |||
| 93b6a714e3 | |||
| ae4775159f | |||
| e23850d906 | |||
| 93e42818ce | |||
| e03fc05da9 | |||
| 6b69ebca4c | |||
| 0de826c2e4 | |||
| db7aec1be1 | |||
| b674bc2def | |||
| 80695ed36f | |||
| 2bfc6df91f | |||
| 3c30ba95ac | |||
| 3333bca539 | |||
| 6bc2b07a83 | |||
| e16438973b | |||
| b368215d55 | |||
| ee49cc7244 | |||
| aedc566dbc | |||
| 63ad1578e9 | |||
| a4e23c3f29 | |||
| 114281c35f | |||
| fa98838b18 | |||
| fd9e27637b | |||
| d0210f1a97 | |||
| 612a414635 | |||
| dc4b442da0 | |||
| 01d2128e72 | |||
| b61696b001 | |||
| 8b641e8b39 | |||
| 4d7ff17612 | |||
| 5fc5484dc0 | |||
| 4304ff302c | |||
| 5db411f409 | |||
| c76ef7da6e | |||
| 87dabce8ab | |||
| 2c8825d055 | |||
| 86662d6622 | |||
| f24ff419fb | |||
| e738100037 | |||
| 0ed859fb0c | |||
| b70421d60c | |||
| c828738017 | |||
| 4a9dbe4e54 | |||
| 6c71ebfd19 | |||
| ca45afade8 | |||
| bd72f6d0fc | |||
| 1bfcd9177d | |||
| 19777c1b18 | |||
| 88c6821380 | |||
| e4f7efcdaf | |||
| ff87565992 | |||
| 17973871f4 | |||
| 045ab5a5af | |||
| b16977141a | |||
| 0708035787 | |||
| 3d1c367c83 | |||
| bfcbfa4ce8 | |||
| 636382158e | |||
| 6789644372 | |||
| 8ba8b0e690 | |||
| 1b4cb15842 | |||
| b2daa3800e | |||
| ff1f1b4e44 | |||
| 6223f4d077 | |||
| 779b8bbf5a | |||
| b7bd24dfbc | |||
| 11f47e7461 | |||
| 76c3e2adb6 | |||
| 2c0fbdff6d | |||
| e4b7cec6b5 | |||
| dfa479f9e0 | |||
| 2fa6626ab8 | |||
| 0ce90db7cc | |||
| cd1cfe9da6 | |||
| cacd15a652 | |||
| 9ec8b7bec1 | |||
| 1340741fc8 | |||
| 480bb03fe9 | |||
| 930568c457 | |||
| e5caeeff1c | |||
| 2e694ebbea | |||
| 55fb80092e | |||
| 32529246e7 | |||
| 62211abe59 | |||
| d597f65ffc | |||
| 30ad1a53c8 | |||
| 191d207700 | |||
| 6427c64e58 | |||
| 1ab84d0051 | |||
| ed9d43e10d | |||
| 0bbcb5bb5b | |||
| c34ddbe52e | |||
| 2f77b509e8 | |||
| 271768ca8e | |||
| bc2546c2fb | |||
| 669ab72e4d | |||
| 159a66133c | |||
| 37148348d7 | |||
| 773b8750da | |||
| 251d3915ae | |||
| adcb0f28eb | |||
| c398472a8b |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
.DS_Store
|
||||
36
ESXi-GetPercDriveTemps.sh
Executable file
36
ESXi-GetPercDriveTemps.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# wget -qO- https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/ESXi-GetPercDriveTemps.sh | sh
|
||||
# ssh -q -o ConnectTimeout=3 -o ConnectionAttempts=1 root@${vHOSTIP} 'wget -qO- https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/ESXi-GetPercDriveTemps.sh | sh'
|
||||
|
||||
|
||||
echo
|
||||
# echo "----------------------------------------------------------------------------"
|
||||
# echo " [MODEL] [SERIAL] [TEMPERATURE]"
|
||||
# echo "----------------------------------------------------------------------------"
|
||||
|
||||
for c in $(/opt/lsi/perccli64/perccli64 show | grep PERC | cut -d' ' -f 3); do
|
||||
controller_info=$(/opt/lsi/perccli64/perccli64 /c${c} show)
|
||||
echo "----------------------------------------------------------------------------"
|
||||
echo "- Controller #${c} - [$(echo "${controller_info}" | grep "Product Name" | cut -d'=' -f 2) ]"
|
||||
echo "----------------------------------------------------------------------------"
|
||||
for e in $(echo "${controller_info}" | grep " OK" | cut -d' ' -f 2); do
|
||||
echo " - Enclosure #${e}"
|
||||
for s in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24; do
|
||||
info=$(/opt/lsi/perccli64/perccli64 /c${c}/e${e}/s${s} show all)
|
||||
if [ "$(echo "${info}" | grep "Drive not found")" == "" ]; then
|
||||
[ ${s} -lt 10 ] && ss="0${s}" || ss=${s}
|
||||
sn=$(echo "${info}" | grep "SN =" | cut -d'=' -f 2 | sed 's/ //g')
|
||||
model=$(echo "${info}" | grep "Model Number" | cut -d'=' -f 2)
|
||||
temp=$(echo "${info}" | grep Temperature | cut -d'=' -f 2)
|
||||
tmp="${model} ${sn}"
|
||||
cc=0; spc=''; spc1=`expr 37 - ${#tmp}`; until [ ${cc} = ${spc1} ]; do spc="${spc} "; cc=$(expr ${cc} + 1); done
|
||||
echo " - Slot #${ss} -${tmp}${spc}${temp}"
|
||||
fi
|
||||
done
|
||||
done
|
||||
echo
|
||||
done
|
||||
echo
|
||||
|
||||
exit 0
|
||||
32
Veeam-Services-Control.cmd
Normal file
32
Veeam-Services-Control.cmd
Normal file
@@ -0,0 +1,32 @@
|
||||
@echo off
|
||||
|
||||
fsutil dirty query "%SystemDrive%">nul 2>&1 || "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -Command "Start-Process '%~f0' -Verb RunAs" 2>nul && goto :eof || goto :eof
|
||||
|
||||
:menu
|
||||
set switch=
|
||||
set start=
|
||||
cls
|
||||
echo Veeam Services Control
|
||||
echo ----------------------
|
||||
echo 1) Start
|
||||
echo 2) Stop
|
||||
echo 3) Restart
|
||||
echo ----------------------
|
||||
choice /c:123 /n /m "#: "
|
||||
|
||||
if "%errorlevel%"=="1" set switch=start
|
||||
if "%errorlevel%"=="2" set switch=stop
|
||||
if "%errorlevel%"=="3" (
|
||||
set switch=stop
|
||||
set start=true
|
||||
)
|
||||
|
||||
for /f "tokens=2" %%? in ('sc query type^= service state^= all^|find /i "veeam"^|find /i "service_name"^|find /i /v "sqlagent"^|find /i /v "postgresql-x64-15"^|find /i /v "veeam.archiver"') do net %switch% /y "%%?"
|
||||
if "%switch%"=="stop" for /f "tokens=3*" %%? in ('tasklist /fo list^|find /i "veeam"^|find /i /v "veeam.archiver"') do taskkill /f /im "%%?"
|
||||
if "%start%"=="true" for /f "tokens=2" %%? in ('sc query type^= service state^= all^|find /i "veeam"^|find /i "service_name"^|find /i /v "sqlagent"^|find /i /v "postgresql-x64-15"^|find /i /v "veeam.archiver"') do net start /y "%%?"
|
||||
|
||||
echo ""
|
||||
#pause
|
||||
#goto menus
|
||||
|
||||
:eof
|
||||
54
add-linux-pass.sh
Executable file
54
add-linux-pass.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
[ -d /opt/idssys/nodemgmt ] && source /opt/idssys/nodemgmt/defaults.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
if [ "${NM_GITUSER}" != "" ] && [ "${NM_GITPASS}" != "" ]; then
|
||||
gituser=${NM_GITUSER}
|
||||
gitpass=${NM_GITPASS}
|
||||
else
|
||||
echo -e "${idsCL[LightCyan]}You'll need to authorize yourself${idsCL[Default]}\n"
|
||||
until [ "${gituser}" != "" ]; do
|
||||
echo -en "${idsCL[LightCyan]}Username: ${idsCL[Default]}"
|
||||
read gituser
|
||||
echo
|
||||
done
|
||||
until [ "${gitpass}" != "" ]; do
|
||||
echo -en "${idsCL[LightCyan]}Password: ${idsCL[Default]}"
|
||||
read gitpass
|
||||
echo
|
||||
done
|
||||
fi
|
||||
if [ "$(curl -u "${gituser}:${gitpass}" -sL https://git.schroedercity.com/voltron/private/raw/branch/master/secret.gpg)" == "Verify" ]; then
|
||||
echo -e "${idsCL[LightRed]}Authorization Failed${idsCL[Default]}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}Adding Linux Pass Sync${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
apt -y install pass git curl gpg
|
||||
|
||||
git clone https://git.schroedercity.com/voltron/ids-linux-pass.git ~/.password-store
|
||||
chmod -R 600 /root/.password-store
|
||||
git config --global credential.helper store
|
||||
|
||||
|
||||
|
||||
|
||||
curl -u "${gituser}:${gitpass}" -sL -o /tmp/secret.gpg https://git.schroedercity.com/voltron/private/raw/branch/master/secret.gpg
|
||||
curl -u "${gituser}:${gitpass}" -sL -o /tmp/idsvc.key https://git.schroedercity.com/voltron/private/raw/branch/master/idsvc.key
|
||||
gpg --import /tmp/secret.gpg
|
||||
gpg --import /tmp/idsvc.key
|
||||
rm -f /tmp/secret.gpg /tmp/idsvc.key
|
||||
|
||||
|
||||
|
||||
exit 0
|
||||
37
add-veeam-user.sh
Executable file
37
add-veeam-user.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo -e "${idsCL[LightGreen]}Add Veeam User${idsCL[Default]}"
|
||||
echo
|
||||
|
||||
# echo -e -n "${idsCL[LightCyan]}Enter password for veeamuser: ${idsCL[Default]}"
|
||||
# read -s PASSWORD
|
||||
# echo
|
||||
|
||||
sudo userdel -r veeamuser >/dev/null 2>&1
|
||||
grep -v "veeamuser ALL=(ALL) NOPASSWD: ALL" /etc/sudoers > /tmp/stmp && rm -f /etc/sudoers && mv /tmp/stmp /etc/sudoers
|
||||
grep -v "veeamuser ALL=(root) ALL" /etc/sudoers > /tmp/stmp && rm -f /etc/sudoers && mv /tmp/stmp /etc/sudoers
|
||||
|
||||
sudo useradd -m -s /bin/bash veeamuser
|
||||
# printf '%s\n' "${PASSWORD}" "${PASSWORD}" | passwd -- veeamuser >/dev/null 2>&1
|
||||
sudo passwd veeamuser
|
||||
sudo usermod -aG sudo veeamuser
|
||||
sudo usermod -aG veeam veeamuser >/dev/null 2>&1
|
||||
sudo echo -e "veeamuser ALL=(ALL) NOPASSWD: ALL\nveeamuser ALL=(root) ALL" >> /etc/sudoers
|
||||
|
||||
|
||||
echo
|
||||
echo -e "${idsCL[Green]}The Veeam user has been added${idsCL[Default]}"
|
||||
echo
|
||||
|
||||
|
||||
exit 0
|
||||
127
cc-reinstall.sh
Executable file
127
cc-reinstall.sh
Executable file
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}Cluster Control Removal Script${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
cd ~
|
||||
rm -f ./install-cc
|
||||
wget https://severalnines.com/downloads/cmon/install-cc
|
||||
chmod +x ./install-cc
|
||||
sed -i 's/\/var\/lib\/mysql\/mysql.sock/\/var\/run\/mysqld\/mysqld.sock/g' ./install-cc
|
||||
|
||||
|
||||
read -n 1 -p "Are you sure you wish to remove Cluster Control and all data (Y/n)?" choice
|
||||
case "$choice" in
|
||||
[Nn]) echo '';;
|
||||
* )
|
||||
echo ''
|
||||
apt remove --purge -y --autoremove clustercontrol*
|
||||
apt remove --purge -y --autoremove mysql-server*
|
||||
apt remove --purge -y --autoremove mysql* *s9s* apache2 php*
|
||||
|
||||
# /root/install-cc --uninstall
|
||||
|
||||
apt clean
|
||||
|
||||
rm -Rf /etc/apache2
|
||||
rm -Rf /etc/cmon.d
|
||||
rm -Rf /etc/mysql
|
||||
rm -Rf /etc/php
|
||||
rm -Rf /etc/s9s.conf
|
||||
rm -f /etc/ssl/certs/s9server*
|
||||
rm -Rf /root/.s9s
|
||||
rm -Rf /root/s9s_tmp
|
||||
rm -Rf /var/lib/cmon
|
||||
rm -Rf /var/lib/mysql
|
||||
rm -Rf /var/lib/prometheus
|
||||
rm -Rf /var/cache/cmon
|
||||
rm -Rf /var/www
|
||||
rm -Rf /var/www/clustercontrol
|
||||
rm -f /var/log/cmon*
|
||||
find /etc -iname "*cmon*" -exec rm {} \;
|
||||
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
|
||||
read -n 1 -p "Would you like to now re-install Cluster Control (Y/n)?" choice
|
||||
case "$choice" in
|
||||
[Nn]) echo ''; exit 0;;
|
||||
* )
|
||||
./install-cc -1
|
||||
apt install -y mailutils
|
||||
/opt/copycerts.sh
|
||||
|
||||
echo
|
||||
echo
|
||||
read -p "Enter a password to set for the Admin account in MySQL: " pwd
|
||||
echo
|
||||
echo "Enter the root MySQL password:"
|
||||
mysql -u root -p -e "CREATE USER 'admin'@'%' IDENTIFIED BY '${pwd}';GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;"
|
||||
|
||||
read -n 1 -p "Login at https://mysql.scity.us and setup the admin user, verify it brings up the deploy prompt. Once complete then press ENTER" choice2
|
||||
echo
|
||||
echo
|
||||
echo "Importing Previous Database Clusters"
|
||||
|
||||
/usr/bin/s9s cluster --register \
|
||||
--cluster-type=galera \
|
||||
--nodes="10.10.1.51;10.10.1.52;10.2.1.51" \
|
||||
--vendor=mariadb \
|
||||
--provider-version=10.4 \
|
||||
--db-admin="root" \
|
||||
--db-admin-passwd='Dc$@54115' \
|
||||
--os-user=root \
|
||||
--os-key-file=/root/.ssh/id_rsa \
|
||||
--cluster-name="iDS-MySQL-Galera"
|
||||
|
||||
# /usr/bin/s9s cluster --register \
|
||||
# --cluster-type=postgresql \
|
||||
# --nodes="10.10.0.211;10.10.0.212" \
|
||||
# --vendor=mariadb \
|
||||
# --provider-version=13 \
|
||||
# --db-admin="root" \
|
||||
# --db-admin-passwd='Dc$@54115' \
|
||||
# --os-user=root \
|
||||
# --os-key-file=/root/.ssh/id_rsa \
|
||||
# --cluster-name="Headscale-PostgreSQL"
|
||||
|
||||
# --nodes="10.10.10.10;10.10.10.11;10.2.1.5;10.2.1.6" \
|
||||
/usr/bin/s9s cluster --register \
|
||||
--cluster-type=galera \
|
||||
--nodes="10.10.10.10;10.10.10.11;10.2.1.5" \
|
||||
--vendor=mariadb \
|
||||
--provider-version=10.6 \
|
||||
--db-admin="root" \
|
||||
--db-admin-passwd='Dc$@54115' \
|
||||
--os-user=root \
|
||||
--os-key-file=/root/.ssh/id_rsa \
|
||||
--cluster-name="LAN-DNS-MySQL-Galera"
|
||||
|
||||
/usr/bin/s9s cluster --register \
|
||||
--cluster-type=galera \
|
||||
--nodes="100.100.20.1;100.100.20.2;100.100.20.3" \
|
||||
--vendor=mariadb \
|
||||
--provider-version=10.6 \
|
||||
--db-admin="root" \
|
||||
--db-admin-passwd='Dc$@54115' \
|
||||
--os-user=root \
|
||||
--os-key-file=/root/.ssh/id_rsa \
|
||||
--cluster-name="WAN-DNS-MySQL-Galera"
|
||||
|
||||
# bash <(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/install-postfix.sh)
|
||||
|
||||
echo
|
||||
echo "Install Completed"
|
||||
;; esac
|
||||
|
||||
exit 0
|
||||
23
default.inc
23
default.inc
@@ -27,6 +27,29 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
is_array()
|
||||
{ #detect if arg is an array, returns 0 on sucess, 1 otherwise
|
||||
[ -z "$1" ] && return 1
|
||||
if [ -n "$BASH" ]; then
|
||||
declare -p ${1} 2> /dev/null | grep 'declare \-a' >/dev/null && return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
CHECK_HOST(){
|
||||
if [ ! -z ${1+x} ]; then
|
||||
ping -c 6 ${1} > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo false
|
||||
else
|
||||
echo true
|
||||
fi
|
||||
else
|
||||
echo false
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
declare -A abet
|
||||
abet[0]="a"
|
||||
abet[1]="b"
|
||||
|
||||
52
defaults/direct.auth.cf
Normal file
52
defaults/direct.auth.cf
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
||||
|
||||
|
||||
# Debian specific: Specifying a file name will cause the first
|
||||
# line of that file to be used as the name. The Debian default
|
||||
# is /etc/mailname.
|
||||
#myorigin = /etc/mailname
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
||||
biff = no
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
|
||||
# Uncomment the next line to generate "delayed mail" warnings
|
||||
#delay_warning_time = 4h
|
||||
|
||||
readme_directory = no
|
||||
|
||||
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
|
||||
# fresh installs.
|
||||
compatibility_level = 2
|
||||
|
||||
|
||||
# TLS parameters
|
||||
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
||||
smtpd_use_tls=yes
|
||||
#smtp_tls_CApath=/etc/ssl/certs
|
||||
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
|
||||
|
||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||
myhostname = scity.us
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
myorigin = /etc/mailname
|
||||
mydestination = $myhostname, <<HOSTNAME>>.scity.us, localhost.scity.us, localhost
|
||||
relayhost = [pro.turbo-smtp.com]:587
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
inet_interfaces = loopback-only
|
||||
inet_protocols = all
|
||||
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
|
||||
|
||||
smtp_sasl_auth_enable = yes
|
||||
smtp_tls_security_level = encrypt
|
||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||
smtp_sasl_security_options = noanonymous
|
||||
52
defaults/main.auth.cf
Normal file
52
defaults/main.auth.cf
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
||||
|
||||
|
||||
# Debian specific: Specifying a file name will cause the first
|
||||
# line of that file to be used as the name. The Debian default
|
||||
# is /etc/mailname.
|
||||
#myorigin = /etc/mailname
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
||||
biff = no
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
|
||||
# Uncomment the next line to generate "delayed mail" warnings
|
||||
#delay_warning_time = 4h
|
||||
|
||||
readme_directory = no
|
||||
|
||||
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
|
||||
# fresh installs.
|
||||
compatibility_level = 2
|
||||
|
||||
|
||||
# TLS parameters
|
||||
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
||||
smtpd_use_tls=yes
|
||||
#smtp_tls_CApath=/etc/ssl/certs
|
||||
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
|
||||
|
||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||
myhostname = scity.us
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
myorigin = /etc/mailname
|
||||
mydestination = $myhostname, <<HOSTNAME>>.scity.us, localhost.scity.us, localhost
|
||||
relayhost = [mail.scity.us]:587
|
||||
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
inet_interfaces = loopback-only
|
||||
inet_protocols = all
|
||||
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
|
||||
|
||||
smtp_sasl_auth_enable = yes
|
||||
smtp_tls_security_level = encrypt
|
||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||
smtp_sasl_security_options = noanonymous
|
||||
48
defaults/main.cf
Normal file
48
defaults/main.cf
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
|
||||
|
||||
|
||||
# Debian specific: Specifying a file name will cause the first
|
||||
# line of that file to be used as the name. The Debian default
|
||||
# is /etc/mailname.
|
||||
#myorigin = /etc/mailname
|
||||
|
||||
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
|
||||
biff = no
|
||||
|
||||
# appending .domain is the MUA's job.
|
||||
append_dot_mydomain = no
|
||||
|
||||
# Uncomment the next line to generate "delayed mail" warnings
|
||||
#delay_warning_time = 4h
|
||||
|
||||
readme_directory = no
|
||||
|
||||
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
|
||||
# fresh installs.
|
||||
compatibility_level = 2
|
||||
|
||||
|
||||
# TLS parameters
|
||||
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
|
||||
smtpd_use_tls=yes
|
||||
#smtp_tls_CApath=/etc/ssl/certs
|
||||
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
|
||||
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
|
||||
|
||||
|
||||
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
|
||||
myhostname = scity.us
|
||||
alias_maps = hash:/etc/aliases
|
||||
alias_database = hash:/etc/aliases
|
||||
myorigin = /etc/mailname
|
||||
mydestination = $myhostname, <<HOSTNAME>>.scity.us, localhost.scity.us, localhost
|
||||
relayhost = smtp.scity.us
|
||||
mynetworks = 127.0.0.0/8
|
||||
mailbox_size_limit = 0
|
||||
recipient_delimiter = +
|
||||
inet_interfaces = loopback-only
|
||||
inet_protocols = ipv4
|
||||
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
|
||||
|
||||
1
defaults/sender_canonical
Normal file
1
defaults/sender_canonical
Normal file
@@ -0,0 +1 @@
|
||||
/.+/ <<FROMEMAIL>>@scity.us
|
||||
4
filewatcher.sh
Executable file → Normal file
4
filewatcher.sh
Executable file → Normal file
@@ -27,9 +27,9 @@ echo "Monitoring file $1 for changes - sending alerts to $2"
|
||||
while inotifywait -e modify -e attrib -e move -e delete $1 -o /opt/filewatcher/audit.log; do
|
||||
sleep 1
|
||||
|
||||
# changes="$(tail -n5 $1)"
|
||||
changes="$(tail -1 $1)"
|
||||
|
||||
changes="$(cat /opt/filewatcher/audit.log)"
|
||||
#changes="$(cat /opt/filewatcher/audit.log)"
|
||||
echo "The following change occurred in the file $1 : $changes" | mail -s "Change in $1" $2
|
||||
rm /opt/filewatcher/audit.log
|
||||
touch /opt/filewatcher/audit.log
|
||||
|
||||
19
get-wanip.sh
Executable file
19
get-wanip.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
wanip="$(dig +short myip.opendns.com @resolver1.opendns.com)" >/dev/null 2>&1
|
||||
if [ "${wanip}" == "" ]; then
|
||||
wanip="$(host myip.opendns.com resolver1.opendns.com)" >/dev/null 2>&1
|
||||
if [ "${wanip}" == "" ]; then
|
||||
wanip="$(curl https://ipinfo.io/ip)" >/dev/null 2>&1
|
||||
if [ "${wanip}" == "" ]; then
|
||||
wanip="$(wget -qO- https://ipecho.net/plain ; echo)" >/dev/null 2>&1
|
||||
else
|
||||
echo "WAN IP could not be found"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${wanip}"
|
||||
|
||||
exit 0
|
||||
214
install-dsmon.sh
Executable file
214
install-dsmon.sh
Executable file
@@ -0,0 +1,214 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}DiskSpace-Monitor Installation Script${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
if [ -d "/opt/idssys/dsmon" ]; then
|
||||
echo -en "${idsCL[Yellow]}DiskSpace-Monitor is already installed, would you like to re-install (y/N)? ${idsCL[Default]}"
|
||||
read reinstall
|
||||
case $reinstall in
|
||||
[Yy])
|
||||
rm -f /usr/local/bin/dsmon
|
||||
rm -Rf /opt/idssys/dsmon
|
||||
;;
|
||||
*) EXIT1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
[ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && RNIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5; exit }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) ||
|
||||
RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
||||
|
||||
if [[ "${RNIP}" == "10.6.1"* ]]; then
|
||||
mysqlip=10.6.1.5
|
||||
mysqlcmd="mariadb --skip-ssl"
|
||||
do_with_root $APTFUNC install wget curl git mailutils bc mariadb-client expect
|
||||
else
|
||||
mysqlcmd="mariadb --skip-ssl"
|
||||
do_with_root $APTFUNC install wget curl git mailutils bc mariadb-client expect
|
||||
if [ "$(CHECK_HOST 10.10.1.50)" != "false" ]; then
|
||||
mysqlip=10.10.1.50
|
||||
elif [ "$(CHECK_HOST 100.100.2.2)" != "false" ]; then
|
||||
mysqlip=100.100.2.2
|
||||
else
|
||||
mysqlip=
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/dsmon.git /opt/idssys/dsmon
|
||||
do_with_root ln -s /opt/idssys/dsmon/run.sh /usr/local/bin/dsmon
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
#touch /opt/idssys/dsmon/config.settings.inc
|
||||
echo -e "declare -A THRESHOLD" > /opt/idssys/dsmon/config.settings.inc
|
||||
echo ""
|
||||
|
||||
DRIVEINFO=$(df -BM | grep -vE '^Filesystem|tmpfs|cdrom|@|ram|loop|udev|veeamimage|localhost|shm|overlay|-volume|Music|Software|//|AFS' | awk '{ print $1 " " $2 " " $4 }')
|
||||
DRIVEINFO=(${DRIVEINFO})
|
||||
NUMDRIVES=$((${#DRIVEINFO[@]} / 3))
|
||||
|
||||
|
||||
for ((i = 0 ; i <= $((${NUMDRIVES}-1)) ; i++)); do
|
||||
ii=$((${i}*3))
|
||||
ia=${DRIVEINFO[${ii}]}
|
||||
ib=$(bc <<< "scale=2; ${DRIVEINFO[$((${ii}+1))]//M/}/1024")
|
||||
ic=$(bc <<< "scale=2; ${DRIVEINFO[$((${ii}+2))]//M/}/1024")
|
||||
ia=${ia//\/dev\/mapper\//}
|
||||
ia=${ia//\/dev\//}
|
||||
|
||||
if [[ "${ia}" = *"sda"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||
systempartition=true
|
||||
elif [ "${ia}" = "shm" ] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||
systempartition=true
|
||||
elif [[ "${ia}" = *"nvme"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||
systempartition=true
|
||||
elif [[ "${ia}" = *"mmcblk"* ]] && [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||
systempartition=true
|
||||
elif [ ${DRIVEINFO[$((${ii}+1))]//M/} -lt 1024 ]; then
|
||||
systempartition=true
|
||||
elif [ "${ia}" != "overlay" ]; then
|
||||
#echo "${ia};${ib};${ic}"
|
||||
|
||||
THRESHOLDSPACE=$(bc <<< "scale=2; ${ib}*.8")
|
||||
|
||||
echo -e "${idsCL[LightCyan]}(${ia}) total size: ${idsCL[LightGreen]}${ib}GB${idsCL[Default]}"
|
||||
echo -e "${idsCL[LightCyan]}Using the default threshold of 80% would alert at: ${idsCL[LightGreen]}${THRESHOLDSPACE}GB${idsCL[Default]}"
|
||||
|
||||
echo -e -n "${idsCL[LightCyan]}What threshold should we set for this drive? Default=80: ${idsCL[Default]}"
|
||||
read SET_THRESHOLD
|
||||
echo ""
|
||||
|
||||
if [ "${SET_THRESHOLD}" = "" ]; then
|
||||
SET_THRESHOLD=80
|
||||
fi
|
||||
|
||||
echo -e "THRESHOLD['${ia}']=${SET_THRESHOLD}" >> /opt/idssys/dsmon/config.settings.inc
|
||||
echo ""
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo -e -n "${idsCL[LightCyan]}Email address to receive alerts: ${idsCL[Default]}"
|
||||
read SET_ALERTEMAIL
|
||||
echo ""
|
||||
|
||||
if [ "${SET_ALERTEMAIL}" = "push" ]; then
|
||||
SET_ALERTEMAIL='b3upzaom7a@pomail.net'
|
||||
elif [ "${SET_ALERTEMAIL}" = "kyle" ]; then
|
||||
SET_ALERTEMAIL='qk7y2gwrjn@pomail.net'
|
||||
fi
|
||||
|
||||
echo -e -n "${idsCL[LightCyan]}Server Monitor ID (optional, or type 'new'): ${idsCL[Default]}"
|
||||
read SET_SERVERMONID
|
||||
echo ""
|
||||
|
||||
if [ "${SET_ALERTEMAIL}" != "" ]; then
|
||||
echo -e "${idsCL[Yellow]}Sending test Alert... ${idsCL[Default]}"
|
||||
echo "Test Alert" | mail -r DSMon_$(hostname -s)@scity.us -s "Test" ${SET_ALERTEMAIL}
|
||||
fi
|
||||
|
||||
echo -e "${idsCL[Yellow]}Adding task to crontab... ${idsCL[Default]}"
|
||||
crontab -l | grep -v 'dsmon hdd' | crontab -
|
||||
crontab -l | grep -v 'dsmon sys' | crontab -
|
||||
sleep 1s
|
||||
(crontab -l ; echo "$(($RANDOM % 59)) */1 * * * /usr/local/bin/dsmon run hdd >/dev/null 2>&1")| crontab -
|
||||
# sleep 1s
|
||||
# (crontab -l ; echo "*/5+$(($RANDOM % 4)) * * * * /usr/local/bin/dsmon run sys >/dev/null 2>&1")| crontab -
|
||||
|
||||
|
||||
if [ "${SET_SERVERMONID}" = "new" ]; then
|
||||
hostname=`hostname`
|
||||
echo -e -n "${idsCL[LightCyan]}Server Name (Default = \"${hostname}\"): ${idsCL[Default]}"
|
||||
read ADD_SERVERNAME
|
||||
echo ""
|
||||
|
||||
if [ "${ADD_SERVERNAME}" = "" ]; then
|
||||
ADD_SERVERNAME=${hostname}
|
||||
fi
|
||||
|
||||
source /opt/idssys/dsmon/config.settings.inc
|
||||
|
||||
ADD_SERVERHOSTNAME=(`hostname`)
|
||||
ADD_SERVERHOSTNAME_FULL=(`hostname -f`)
|
||||
ADD_SERVERIP=(`hostname -I`)
|
||||
ADD_SERVERIPS=''
|
||||
for nip in "${ADD_SERVERIP[@]}"; do
|
||||
if [[ "${nip}" == *"."* ]] && [[ "${nip}" != *"172"* ]]; then
|
||||
if [ "${ADD_SERVERIPS}" = "" ]; then
|
||||
SERVERIPS=${nip}
|
||||
else
|
||||
SERVERIPS=${ADD_SERVERIPS}";"${nip}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
thresholdlog=()
|
||||
for KEY in "${!THRESHOLD[@]}"; do
|
||||
thresholdlog+=("${KEY}:${THRESHOLD[$KEY]}")
|
||||
done
|
||||
|
||||
if [ "${mysqlip}" != "" ]; then
|
||||
QRY="USE servermonitor; INSERT INTO hosts (\`host\`,\`hostname\`,\`hostname_full\`,\`ip\`,\`limits\`) VALUES ('${ADD_SERVERNAME}','${ADD_SERVERHOSTNAME}','${ADD_SERVERHOSTNAME_FULL}','${SERVERIPS// /}','${thresholdlog[@]}');"
|
||||
${mysqlcmd} -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"
|
||||
QRY="USE servermonitor; SELECT id FROM hosts WHERE host='${ADD_SERVERNAME}';"
|
||||
SET_SERVERMONID=`${mysqlcmd} -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"`
|
||||
else
|
||||
echo -e "${idsCL[Red]}Could not connect to MySQL${idsCL[Default]}"
|
||||
fi
|
||||
|
||||
echo -en "${idsCL[LightGreen]}Server successfully added, it was given ID# "
|
||||
echo -e ${SET_SERVERMONID//id
|
||||
}${idsCL[Default]}
|
||||
echo ""
|
||||
|
||||
fi
|
||||
|
||||
echo -e "
|
||||
|
||||
#(optional)" >> /opt/idssys/dsmon/config.settings.inc
|
||||
[ "${SET_ALERTEMAIL}" != "" ] && echo -e "EMAIL_NOTICE=${SET_ALERTEMAIL}" >> /opt/idssys/dsmon/config.settings.inc || echo -e "# EMAIL_NOTICE=email@address.com" >> /opt/idssys/dsmon/config.settings.inc
|
||||
echo -e "# PUSHOVER_APP_TOKEN=\"atm1fd2fj8b5mopddior57dmrdq8ny\"
|
||||
# PUSHOVER_USER_TOKEN=\"\"
|
||||
|
||||
SERVERMON_ID=${SET_SERVERMONID//id
|
||||
/}
|
||||
" >> /opt/idssys/dsmon/config.settings.inc
|
||||
|
||||
echo -e "
|
||||
mail -r DSMon-\$(hostname -s)@scity.us -s 'Disk Space Alert' \${SET_ALERTEMAIL} << EOF
|
||||
Your root partition remaining free space is running low. Used: \$CURRENT%
|
||||
EOF
|
||||
|
||||
echo \"** Low Disk Space Alert Sent **\" >> /opt/idssys/dsmon/diskspace.log
|
||||
|
||||
#Add any additional system specific actions that should occur when a low disk space alert has been triggered
|
||||
|
||||
" > /opt/idssys/dsmon/config.actions.inc
|
||||
|
||||
|
||||
/usr/local/bin/dsmon run hdd
|
||||
# /usr/local/bin/dsmon run sys
|
||||
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}DiskSpace-Monitor has been Installed. Please make sure this system can send emails using the mail command.${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
|
||||
exit 0
|
||||
42
install-esxipower.sh
Executable file
42
install-esxipower.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
else APTFUNC="${ATYPE}"
|
||||
fi
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}ESXi-Power Installation Script${idsCL[Default]}"
|
||||
|
||||
do_with_root $APTFUNC -y install wget curl git
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/esxi-power.git /opt/idssys/esxi-power
|
||||
do_with_root ln -s /opt/idssys/esxi-power/run.sh /usr/local/bin/esxipower
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/idssys/settings" ]; then
|
||||
do_with_root mkdir /opt/idssys/settings
|
||||
fi
|
||||
echo -e "" > /opt/idssys/settings/esxi-power.conf
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}ESXi-Power has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo -e "To run ESXi-Power, use the command: ${idsCL[Green]}esxipower${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
@@ -1,7 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
if type apt &>/dev/null; then
|
||||
ATYPE="apt"
|
||||
|
||||
@@ -11,12 +11,12 @@ Red='\033[10;31m'
|
||||
LRed='\033[1;31m'
|
||||
#echo -e "${Green}TEST${Color_Off}"
|
||||
|
||||
echo -e "${BOrange}Preparinfg to install Glances${Color_Off}"
|
||||
echo -e "${BOrange}Preparinig to install Glances${Color_Off}"
|
||||
echo ""
|
||||
|
||||
DEPS=$(whiptail --title "iDS-Glances Auto Install Script" --checklist --separate-output \
|
||||
"\nPlease select which modules to install for Glances to be able\nto utilize for this system:" 28 80 16 \
|
||||
"action" "Allows Glances to trigger actions on events" ON \
|
||||
"action" "Allows Glances to trigger actions on events" OFF \
|
||||
"batinfo" "Displays Battery Stats" OFF \
|
||||
"browser" "Allows for other Glances client browsing" ON \
|
||||
"chart" "Charts Module" OFF \
|
||||
@@ -26,10 +26,10 @@ DEPS=$(whiptail --title "iDS-Glances Auto Install Script" --checklist --separate
|
||||
"export" "Allows for Data Export" OFF \
|
||||
"folders" "Folders Module" ON \
|
||||
"gpu" "Displays GPU Stats" OFF \
|
||||
"ip" "Displays Public and Private Addresses" OFF \
|
||||
"ip" "Displays Public and Private Addresses" ON \
|
||||
"raid" "Displays RAID Stats" OFF \
|
||||
"snmp" "Could retrieve stats from an snmp endpoint" OFF \
|
||||
"web" "Allows Glances to run as a webserver" OFF \
|
||||
"web" "Allows Glances to run as a webserver" ON \
|
||||
"wifi" "Displays WiFi Stats" OFF 3>&1 1>&2 2>&3)
|
||||
exitstatus=$?
|
||||
if [ $exitstatus = 1 ]; then exit; fi
|
||||
@@ -86,13 +86,13 @@ if [[ $distrib_name == "ubuntu" || $distrib_name == "LinuxMint" || $distrib_name
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# Make sure the package repository is up to date
|
||||
do_with_root apt-get -y --force-yes update
|
||||
do_with_root apt-get -y update
|
||||
|
||||
# Install prerequirements
|
||||
do_with_root apt-get install -y --force-yes python3-pip python3-dev gcc lm-sensors python3-setuptools pkg-config
|
||||
do_with_root apt-get install -y python3-pip python3-dev gcc lm-sensors python3-setuptools pkg-config
|
||||
|
||||
if [[ " ${DEPS[@]} " =~ "wifi" ]]; then
|
||||
do_with_root apt-get install -y --force-yes wireless-tools
|
||||
do_with_root apt-get install -y wireless-tools
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
@@ -11,23 +15,24 @@ fi
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}LinUPx Installation Script${idsCL[Default]}"
|
||||
|
||||
do_with_root $APTFUNC -y install wget curl git
|
||||
do_with_root $APTFUNC -y install wget curl git jq grepcidr
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/LinUPx.git /opt/idssys/linupx
|
||||
do_with_root ln -s /opt/idssys/linupx/run.sh /usr/local/bin/runup
|
||||
if [ -d /usr/local/bin/ ]; then
|
||||
do_with_root ln -s /opt/idssys/linupx/run.sh /usr/local/bin/runup
|
||||
elif [ -d /bin/ ]; then
|
||||
do_with_root ln -s /opt/idssys/linupx/run.sh /bin/runup
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/idssys/settings" ]; then
|
||||
do_with_root mkdir /opt/idssys/settings
|
||||
fi
|
||||
echo -e "useAutoremove=1
|
||||
opennms=false
|
||||
RemoteSyslogServer=10.10.10.10" > /opt/idssys/settings/linupx.conf
|
||||
" > /opt/idssys/linupx/settings.conf
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}LinUPx has been Installed${idsCL[Default]}"
|
||||
|
||||
66
install-mediamanager.sh
Executable file
66
install-mediamanager.sh
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}MediaManager Installation Script${idsCL[Default]}"
|
||||
|
||||
do_with_root $APTFUNC -y install wget curl git jq wireguard php
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/mediamanager.git /opt/idssys/mediamanager
|
||||
# do_with_root git clone -b dev https://git.schroedercity.com/voltron/mediamanager.git /opt/idssys/mediamanager
|
||||
do_with_root ln -s /opt/idssys/mediamanager/run.sh /usr/local/bin/mm
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/idssys/settings" ]; then
|
||||
do_with_root mkdir /opt/idssys/settings
|
||||
fi
|
||||
|
||||
echo -e "VPN_INTERFACE=wg-torguard
|
||||
SERVICESCHECK=jackett,qbittorrent,sonarr,radarr,snap.tautulli.tautulli,ombi,bazarr
|
||||
|
||||
#(will not start services if the file /path/to/plex-media/mounted does not exist)
|
||||
PLEX_MOUNT=/path/to/plex-media
|
||||
|
||||
#(optional)
|
||||
# EMAIL_NOTICE=email@address.com
|
||||
# PUSHOVER_APP_TOKEN=""
|
||||
# PUSHOVER_USER_TOKEN=""
|
||||
|
||||
#Torguard VPN Settings
|
||||
VPN_SERVER=chi.central.usa.torguardvpnaccess.com
|
||||
VPN_USER=
|
||||
VPN_PASS=
|
||||
|
||||
" > /opt/idssys/mediamanager/settings.conf
|
||||
|
||||
echo -e "/opt/idssys/mediamanager/logfile {
|
||||
weekly
|
||||
rotate 4
|
||||
}
|
||||
" > /etc/logrotate.d/mm-logfile.conf
|
||||
|
||||
do_with_root mkdir /opt/idssys/mediamanager/logs
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}MediaManager has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo -e "To run, use the command: ${idsCL[Green]}mm${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL https://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL https://scity.xyz/defaultinc)"
|
||||
source /dev/stdin <<< "$(curl -sL https://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL https://go.scity.us/defaultinc)"
|
||||
|
||||
|
||||
# Install: lsb-release
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}MySQL-BU Installation Script${idsCL[Default]}"
|
||||
|
||||
#cd /tmp
|
||||
|
||||
#wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
|
||||
#do_with_root dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
|
||||
#do_with_root percona-release enable-only tools release
|
||||
#do_with_root $APTFUNC update
|
||||
|
||||
#do_with_root curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
|
||||
#do_with_root $APTFUNC -y install wget curl git mariadb-backup
|
||||
|
||||
do_with_root set -eu
|
||||
if [ ! -d "/opt/idssys/settings" ]; then
|
||||
do_with_root mkdir /opt/idssys/settings
|
||||
fi
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/MySQL-BU.git /opt/idssys/mysqlbu
|
||||
do_with_root ln -s /opt/idssys/mysqlbu/run.sh /usr/local/bin/mysqlbu
|
||||
echo -e "BACKUP_PATH=/opt/idssys/backups/mysql-backups
|
||||
BACKUP_HOST_IP=''
|
||||
BACKUP_HOST_PORT=''
|
||||
MYSQLUSER='root'
|
||||
MYSQLPASS=''
|
||||
MYSQLCFG=/etc/mysql/my.cnf
|
||||
BACKUPSTOKEEP=3
|
||||
BACKUP_DAEMON=/usr/bin/mariabackup
|
||||
" > /opt/idssys/settings/mysqlbu.conf
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}MySQL-BU has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo -e "To run backups, use the command: ${idsCL[Green]}mysqlbu${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
@@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}NodeMgmt Installation Script${idsCL[Default]}"
|
||||
|
||||
do_with_root $APTFUNC -y install wget curl git
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/NodeMgmt.git /opt/idssys/nodemgmt
|
||||
do_with_root ln -s /opt/idssys/nodemgmt/run.sh /usr/local/bin/nodemgmt
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
if [ ! -d "/opt/idssys/settings" ]; then
|
||||
do_with_root mkdir /opt/idssys/settings
|
||||
fi
|
||||
echo -e "NODE_HOSTNAME=\"$(hostname)\"
|
||||
#LOCAL_SERVICES=mysql,nginx,gitea,haproxy,keepalived,maxscale
|
||||
#STATUS_CHECK_EMAIL=someone@somewhere.com
|
||||
" > /opt/idssys/settings/nodemgmt.conf
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}NodeMgmt has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo -e "To run, use the command: ${idsCL[Green]}nodemgmt${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
24
install-pgcg-rpisc.sh
Executable file
24
install-pgcg-rpisc.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}PGCG Rpi-SC Installation Script${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
sudo apt -y install wget curl git
|
||||
|
||||
git clone --recursive https://pinegrove@git.schroedercity.com/voltron/PGCG-RPiSC-Installer.git /home/pi/PGCG-RPiSC-Installer
|
||||
|
||||
echo ""
|
||||
|
||||
cd /home/pi/PGCG-RPiSC-Installer
|
||||
bash ./install.sh
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}PGCG Rpi-SC has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
|
||||
exit 0
|
||||
51
install-pibackup.sh
Executable file
51
install-pibackup.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}iDS-piBackup Installation Script${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root $APTFUNC -y install wget curl git parted
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-piBackup.git /opt/idssys/pibackup
|
||||
do_with_root ln -s /opt/idssys/pibackup/run.sh /usr/local/bin/pibackup
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
echo -e -n "${idsCL[LightCyan]}Hostname for backup folder: ${idsCL[Default]}"
|
||||
read -i "$(hostname)" -e SET_HOSTNAME
|
||||
echo ""
|
||||
|
||||
echo -e "
|
||||
hostname='${SET_HOSTNAME}'
|
||||
MountPoint="/mnt/backupfolder"
|
||||
BackupsToKeep=3
|
||||
|
||||
#(optional, for mounting on windows smb)
|
||||
#ServerName="//ip.or.hostname/sharename"
|
||||
#UserName="username"
|
||||
#Password="password"
|
||||
|
||||
" > /opt/idssys/pibackup/settings.inc
|
||||
|
||||
logfile=/opt/idssys/pibackup/logfile
|
||||
touch $logfile
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}iDS-piBackup has been Installed.${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
|
||||
exit 0
|
||||
114
install-postfix.sh
Executable file
114
install-postfix.sh
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}Postfix Installation Script for scity.us${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
read -n 1 -p "Are you sure you wish to install Postfix (Y/n)?" choice
|
||||
case "$choice" in
|
||||
[Nn]) echo "";;
|
||||
* )
|
||||
echo "postfix postfix/mailname string scity.us" | debconf-set-selections
|
||||
echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections
|
||||
|
||||
$APTFUNC install -y postfix mailutils-common mailutils
|
||||
cd /etc/postfix
|
||||
service stop postfix
|
||||
|
||||
echo
|
||||
echo -e -n "${idsCL[LightCyan]}Server is 'I'nternal or 'E'xternal or 'D'irect? ${idsCL[Default]}"
|
||||
read -e SERVERLOC
|
||||
|
||||
[ "${SERVERLOC}" = "" ] && SERVERLOC=I
|
||||
|
||||
rm -f /etc/postfix/main.cf.bak
|
||||
mv /etc/postfix/main.cf /etc/postfix/main.cf.bak
|
||||
|
||||
[ ! -f /etc/mailname ] && echo "scity.us" > /etc/mailname
|
||||
|
||||
case ${SERVERLOC} in
|
||||
[Ii]) wget https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/defaults/main.cf -O /etc/postfix/main.cf;;
|
||||
[Ee])
|
||||
echo
|
||||
echo -e -n "${idsCL[LightCyan]}Username for scity.us domain email: ${idsCL[Default]}"
|
||||
read -i "systems" -e USERNAME
|
||||
echo
|
||||
echo -e -n "${idsCL[LightCyan]}Password for scity.us domain email: ${idsCL[Default]}"
|
||||
read -s PASSWORD
|
||||
echo
|
||||
wget https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/defaults/main.auth.cf -O /etc/postfix/main.cf
|
||||
echo "mail.scity.us ${USERNAME}@scity.us:${PASSWORD}" > /etc/postfix/sasl_passwd
|
||||
sudo chmod 600 /etc/postfix/sasl_passwd
|
||||
sudo postmap /etc/postfix/sasl_passwd
|
||||
sudo rm -f /etc/postfix/sasl_passwd
|
||||
;;
|
||||
[Dd])
|
||||
echo
|
||||
echo -e -n "${idsCL[LightCyan]}Username for direct: ${idsCL[Default]}"
|
||||
read -i "david@schroedercity.com" -e USERNAME
|
||||
echo
|
||||
echo -e -n "${idsCL[LightCyan]}Password for direct: ${idsCL[Default]}"
|
||||
read -s PASSWORD
|
||||
echo
|
||||
wget https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/defaults/direct.auth.cf -O /etc/postfix/main.cf
|
||||
echo "[pro.turbo-smtp.com]:587 ${USERNAME}:${PASSWORD}" > /etc/postfix/sasl_passwd
|
||||
sudo chmod 600 /etc/postfix/sasl_passwd
|
||||
sudo postmap /etc/postfix/sasl_passwd
|
||||
sudo rm -f /etc/postfix/sasl_passwd
|
||||
$APTFUNC install -y libsasl2-modules
|
||||
;;
|
||||
esac
|
||||
|
||||
wget https://git.schroedercity.com/voltron/Misc-Scripts/raw/branch/master/defaults/sender_canonical -O /etc/postfix/sender_canonical
|
||||
|
||||
hostname=`hostname`
|
||||
echo -e -n "${idsCL[LightCyan]}Server Name: ${idsCL[Default]}"
|
||||
read -i "${hostname}" -e pfhostname
|
||||
echo ""
|
||||
|
||||
echo -e -n "${idsCL[LightCyan]}Default from email (portion before @scity.us): ${idsCL[Default]}"
|
||||
read -i "${hostname}" -e pffromemail
|
||||
echo ""
|
||||
|
||||
sed -i "s/<<HOSTNAME>>/${pfhostname}/g" main.cf
|
||||
sed -i "s/<<FROMEMAIL>>/${pffromemail}/g" sender_canonical
|
||||
|
||||
service postfix restart
|
||||
|
||||
echo -e -n "${idsCL[Yellow]}Send test Alert to (leave blank to not send test): ${idsCL[Default]}"
|
||||
read TESTEMAIL
|
||||
|
||||
if [ "${TESTEMAIL}" != "" ]; then
|
||||
if [ "${TESTEMAIL,,}" = "push" ]; then
|
||||
TESTEMAIL='b3upzaom7a@pomail.net'
|
||||
elif [ "${TESTEMAIL,,}" = "mms" ]; then
|
||||
TESTEMAIL='9208839613@mms.att.net'
|
||||
fi
|
||||
[ "$(ip route | awk '/default/ { print $5 }')" == "link" ] && HIP=$(ip addr show $(ip route | awk '/1 dev eth0/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1) ||
|
||||
HIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
||||
echo -e "Received from: ${pffromemail}@scity.us\nHostname: $(hostname) ($(hostname -f))\nIP: ${HIP}\n\n\nSent: $(date)" | mail -r ${pffromemail}@scity.us -s "Test Message (Postfix Install)" $TESTEMAIL
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}Postfix has been Installed${idsCL[Default]}"
|
||||
if [ ${action-x} ]; then exit 0; fi
|
||||
read -n 1 -s -p "Press any key to continue"
|
||||
SCRIPT_MENU;;
|
||||
esac
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}Postfix has not been Installed.${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
|
||||
exit 0
|
||||
40
install-powerwall.sh
Executable file
40
install-powerwall.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
else APTFUNC="${ATYPE}"
|
||||
fi
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}PowerWall Installation Script${idsCL[Default]}"
|
||||
|
||||
$APTFUNC -y install libssl-dev wget curl git ipmitool snmp moreutils python3-pip
|
||||
pip install --break-system-packages python-kasa midea-beautiful-air
|
||||
|
||||
git clone https://git.schroedercity.com/voltron/powerwall.git /opt/idssys/powerwall
|
||||
ln -s /opt/idssys/powerwall/run.sh /usr/local/bin/powerwall
|
||||
ln -s /opt/idssys/powerwall/run.sh /usr/local/bin/pw
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
set -eu
|
||||
git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
echo -e "" > /opt/idssys/powerwall/settings.conf
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}PowerWall has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo -e "To run PowerWall, use the command: ${idsCL[Green]}powerwall${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
32
install-ta_proxmenu.sh
Executable file
32
install-ta_proxmenu.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
[ "$EUID" -ne 0 ] && PTFUNC="sudo ${ATYPE}" || APTFUNC="${ATYPE}"
|
||||
echo -e "\n${idsCL[LightGreen]}LinUPx Installation Script${idsCL[Default]}"
|
||||
do_with_root $APTFUNC -y install wget curl git jq sudo
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/TAI/TA-ProxMenu.git /opt/idssys/ta-proxmenu
|
||||
do_with_root ln -s /opt/idssys/ta-proxmenu/run.sh /usr/local/bin/tapm
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}TA-ProxMenu has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo -e "To run updates, use the command: ${idsCL[Green]}tapm${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
40
install-unifi-poller
Normal file
40
install-unifi-poller
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
else APTFUNC="${ATYPE}"
|
||||
fi
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}UniFi-Poller Setup Script${idsCL[Default]}"
|
||||
|
||||
sudo echo "deb https://repos.influxdata.com/ubuntu bionic stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
|
||||
sudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
|
||||
sudo apt -y update
|
||||
sudo apt install -y influxdb
|
||||
sudo systemctl start influxdb
|
||||
|
||||
influx -host localhost -port 8086 -execute "CREATE DATABASE unifi"
|
||||
influx -host localhost -port 8086 -execute "CREATE USER unifipoller WITH PASSWORD 'unifipoller' WITH ALL PRIVILEGES"
|
||||
influx -host localhost -port 8086 -execute "GRANT ALL ON unifi TO unifipoller"
|
||||
|
||||
curl -s https://golift.io/gpgkey | sudo apt-key add -
|
||||
sudo echo deb https://dl.bintray.com/golift/ubuntu bionic main | sudo tee /etc/apt/sources.list.d/unifi-pollers.list
|
||||
sudo apt update
|
||||
sudo apt install unifi-poller
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}UniFi-Poller has been Installed${idsCL[Default]}"
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
47
install-vpnmon.sh
Executable file
47
install-vpnmon.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}L2TP VPN Monitor Installation Script${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/vpnmon.git /opt/idssys/vpnmon
|
||||
do_with_root ln -s /opt/idssys/vpnmon/run.sh /usr/local/bin/vpnmon
|
||||
|
||||
if [ ! -d "/opt/idssys/defaults" ]; then
|
||||
do_with_root set -eu
|
||||
do_with_root git clone https://git.schroedercity.com/voltron/iDS-Defaults.git /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
echo -e "${idsCL[Yellow]}Adding task to crontab... ${idsCL[Default]}"
|
||||
(crontab -l ; echo "@weekly /usr/local/bin/vpnmon >/dev/null 2>&1")| crontab -
|
||||
sleep 1s
|
||||
(crontab -l ; echo "@reboot /usr/local/bin/vpnmon start >/dev/null 2>&1")| crontab -
|
||||
sleep 1s
|
||||
(crontab -l ; echo "*/5 * * * * /usr/local/bin/vpnmon check >/dev/null 2>&1")| crontab -
|
||||
|
||||
echo -e "
|
||||
SYSTEM=''
|
||||
|
||||
VPN_CFGNAME='' # any name, only letters and numbers, no spaces
|
||||
VPN_INTERFACE='ppp0'
|
||||
|
||||
ROUTE_SUBNET1='' # 10.1.0.0/16
|
||||
ROUTE_SUBNET2=''
|
||||
" > /opt/idssys/vpnmon/system.inc
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[Yellow]}L2TP VPN Monitor has been Installed.${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -2,22 +2,22 @@
|
||||
# Webmin Install Script
|
||||
|
||||
if type apt &>/dev/null; then
|
||||
echo -e "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
|
||||
rm -f /etc/apt/sources.list.d/webmin.list
|
||||
cd /tmp
|
||||
wget -O- http://www.webmin.com/jcameron-key.asc | apt-key add -
|
||||
apt update
|
||||
apt -y install apt-transport-https
|
||||
apt -y install webmin
|
||||
curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
|
||||
bash setup-repos.sh
|
||||
apt install --install-recommends webmin -y
|
||||
|
||||
|
||||
elif type apt-get &>/dev/null; then
|
||||
echo -e "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list
|
||||
rm -f /etc/apt/sources.list.d/webmin.list
|
||||
cd /tmp
|
||||
wget -O- http://www.webmin.com/jcameron-key.asc | apt-key add -
|
||||
apt-get update
|
||||
apt-get -y install apt-transport-https
|
||||
apt-get -y install webmin
|
||||
curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
|
||||
bash setup-repos.sh
|
||||
apt-get install --install-recommends webmin -y
|
||||
|
||||
elif type yum &>/dev/null; then
|
||||
rm -f /etc/yum.repos.d/webmin.repo
|
||||
cat << EOF > /etc/yum.repos.d/webmin.repo
|
||||
[Webmin]
|
||||
name=Webmin Distribution Neutral
|
||||
|
||||
@@ -7,4 +7,4 @@ rm -f /usr/local/bin/runup
|
||||
|
||||
rm -Rf /opt/ubuntu-upscripts
|
||||
|
||||
bash <(curl -sL https://scity.xyz/linupx)
|
||||
bash <(curl -sL https://go.scity.us/linupx)
|
||||
|
||||
19
list-colors.sh
Normal file → Executable file
19
list-colors.sh
Normal file → Executable file
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
clear
|
||||
source /dev/stdin <<< "$(curl -sL https://git.schroedercity.com/voltron/Misc-Scripts/raw/master/colors.inc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
#source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
|
||||
echo ""
|
||||
echo "--------------------------"
|
||||
@@ -11,8 +12,17 @@ for i in "${!idsCL[@]}" ; do
|
||||
#echo "${i}=${idsCL[$i]}"
|
||||
echo -e "${idsCL[$i]}${i}${idsCL[Default]} = \${idsCL[$i]}"
|
||||
done
|
||||
echo
|
||||
|
||||
echo "--------------------------"
|
||||
echo "BOLD COLORS"
|
||||
echo "--------------------------"
|
||||
for i in "${!idsCL[@]}" ; do
|
||||
#echo "${i}=${idsCL[$i]}"
|
||||
echo -e "${idsST[Bold]}${idsCL[$i]}${i}${idsST[Reset]}${idsCL[Default]} = \${idsCL[$i]}"
|
||||
done
|
||||
echo
|
||||
|
||||
echo ""
|
||||
echo "--------------------------"
|
||||
echo "BACKGROUNDS"
|
||||
echo "--------------------------"
|
||||
@@ -21,7 +31,7 @@ for i in "${!idsBG[@]}" ; do
|
||||
echo -e "${idsBG[$i]}${i}${idsBG[Default]} = \${idsBG[$i]}"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo
|
||||
echo "--------------------------"
|
||||
echo "STYLES"
|
||||
echo "--------------------------"
|
||||
@@ -29,3 +39,6 @@ for i in "${!idsST[@]}" ; do
|
||||
#echo "${i}=${idsST[$i]}"
|
||||
echo -e "${idsST[$i]}${i}${idsBG[Default]} = \${idsST[$i]}"
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
35
run-all-speedtests.sh
Executable file
35
run-all-speedtests.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ "${1}" == "" ]; then
|
||||
echo -e "${idsCL[LightGreen]}Run All Local Speedtests${idsCL[Default]}"
|
||||
local_servers=$(speedtest -L)
|
||||
test_servers=(${local_servers//$'\n'/ })
|
||||
else
|
||||
echo -e "${idsCL[LightGreen]}Run Speedtests on '${1}'${idsCL[Default]}"
|
||||
IFS=,; test_servers=(${1}); unset IFS
|
||||
fi
|
||||
echo
|
||||
echo -en "${idsCL[LightCyan]}Do you wish to continue (y/N)?${idsCL[Default]}"
|
||||
read -n 1 continue
|
||||
echo
|
||||
echo
|
||||
case $continue in
|
||||
[Yy])
|
||||
for serverID in ${test_servers[@]}; do
|
||||
sid='^[[:digit:]]{4,6}$'
|
||||
[[ ${serverID} =~ ${sid} ]] && echo -e "${idsCL[Green]}Running on '${serverID}'${idsCL[Default]}" && sleep 5s && speedtest -s ${serverID}
|
||||
done
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,7 +1,12 @@
|
||||
#!/bin/bash
|
||||
clear
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -e "${idsCL[Yellow]}PowerDNS Master & Slave Setup${idsCL[Default]}"
|
||||
|
||||
973
storage-test.sh
Executable file
973
storage-test.sh
Executable file
@@ -0,0 +1,973 @@
|
||||
#!/bin/bash
|
||||
# Orignal script from
|
||||
# Storage benchmark by James A. Chambers (https://jamesachambers.com/)
|
||||
#
|
||||
# Benchmarks your storage and anonymously submits result to https://pibenchmarks.com
|
||||
# Results and discussion available at https://jamesachambers.com/2020s-fastest-raspberry-pi-4-storage-sd-ssd-benchmarks/
|
||||
#
|
||||
#
|
||||
# To run the benchmark use the following command:
|
||||
# sudo curl -sL https://go.scity.us/test-storage | sudo bash
|
||||
|
||||
# Fix language settings for utf8
|
||||
export LC_ALL=C
|
||||
|
||||
# Terminal colors
|
||||
BLACK=$(tput setaf 0)
|
||||
RED=$(tput setaf 1)
|
||||
GREEN=$(tput setaf 2)
|
||||
YELLOW=$(tput setaf 3)
|
||||
LIME_YELLOW=$(tput setaf 190)
|
||||
POWDER_BLUE=$(tput setaf 153)
|
||||
BLUE=$(tput setaf 4)
|
||||
MAGENTA=$(tput setaf 5)
|
||||
CYAN=$(tput setaf 6)
|
||||
WHITE=$(tput setaf 7)
|
||||
BRIGHT=$(tput bold)
|
||||
NORMAL=$(tput sgr0)
|
||||
BLINK=$(tput blink)
|
||||
REVERSE=$(tput smso)
|
||||
UNDERLINE=$(tput smul)
|
||||
|
||||
# Whether apt update has ran
|
||||
AptUpdated="0"
|
||||
|
||||
# Prints a line with color using terminal codes
|
||||
Print_Style() {
|
||||
printf "%s\n" "${2}$1${NORMAL}"
|
||||
}
|
||||
|
||||
# Install apt package
|
||||
Install_Apt_Package() {
|
||||
echo "Install $1"
|
||||
if [ "$AptUpdated" -ne "1" ]; then
|
||||
export AptUpdated="1"
|
||||
apt-get update
|
||||
apt-get install lshw pciutils usbutils lsscsi bc curl hwinfo hdparm nvme-cli dmidecode smartmontools fio sdparm xxd libxml-dumper-perl --no-install-recommends -y
|
||||
fi
|
||||
apt-get install --no-install-recommends "$1" -y
|
||||
}
|
||||
|
||||
# Get binary from string
|
||||
Get_Binary() {
|
||||
local BinaryStr
|
||||
BinaryStr=$(printf "$1" | xxd -r -p | xxd -b | cut -d: -f 2 | sed 's/ .*//; s/ //g' | sed ':a;N;$!ba;s/\n//g')
|
||||
echo "$BinaryStr"
|
||||
}
|
||||
|
||||
# Get specific bits from binary string
|
||||
Get_Bits() {
|
||||
# $1 - Binary String
|
||||
# $2 - BitsStart
|
||||
# $3 - BitsCount
|
||||
# $4 - Structure size in bits
|
||||
local BitsStart=$(($4 - $2 - $3))
|
||||
local BinaryStr=$(printf "$1")
|
||||
echo "${BinaryStr:BitsStart:$3}"
|
||||
}
|
||||
|
||||
# Get decimal from binary
|
||||
Get_Decimal() {
|
||||
echo "$((2#$1))" 2>/dev/null
|
||||
}
|
||||
|
||||
# Get hex from binary
|
||||
Get_Hex() {
|
||||
printf '%x\n' "$((2#$1))"
|
||||
}
|
||||
|
||||
# Get string of text from binary
|
||||
Get_Text() {
|
||||
for a in $1; do printf "%x\n" $((2#$a)); done | xxd -r -p
|
||||
}
|
||||
|
||||
# Check if script is running as root first
|
||||
if [[ "$(whoami)" != "root" ]]; then
|
||||
Print_Style "Benchmarks must be ran as root!" "$RED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Trim drives for more accurate benchmarking
|
||||
Print_Style "Trimming and syncing drives ..." "$YELLOW"
|
||||
fstrim -av
|
||||
sync
|
||||
sync
|
||||
|
||||
# Initialize variables
|
||||
Score=0
|
||||
DDWriteResult=0
|
||||
fio4kRandReadIOPS=0
|
||||
fio4kRandWriteIOPS=0
|
||||
IO4kRead=0
|
||||
IO4kWrite=0
|
||||
IO4kRandRead=0
|
||||
IO4kRandWrite=0
|
||||
|
||||
# Did the user give a folder ?
|
||||
ChosenPartition=""
|
||||
if [ "$1" = "" ]; then
|
||||
drives="$(/bin/df -kTh | grep ext4)"
|
||||
drives2=(${drives})
|
||||
echo
|
||||
Print_Style "Select a drive to test from:" "$YELLOW"
|
||||
df=0
|
||||
echo "$drives" | while IFS= read -r line ; do
|
||||
((df++)); path=$(echo $line | cut -d'%' -f2)
|
||||
Print_Style "$df) ${path// }" "$CYAN"
|
||||
done
|
||||
echo
|
||||
read -r -p '#: ' drive_path </dev/tty
|
||||
df=0
|
||||
while IFS= read -r line ; do
|
||||
((df++)); path=$(echo $line | cut -d'%' -f2)
|
||||
if [ $df -eq $drive_path ]; then
|
||||
ChosenPartition=${path// }
|
||||
cd "${ChosenPartition}"
|
||||
Print_Style "${ChosenPartition} has been selected:" "$YELLOW"
|
||||
echo
|
||||
break
|
||||
fi
|
||||
done <<< "$drives"
|
||||
else
|
||||
if [ ! -d "$1" ]; then
|
||||
Print_Style "Your chosen partition (folder) does not exist! Provide a good one or run without parameters to check the rootfs" "$RED"
|
||||
exit 1
|
||||
else
|
||||
ChosenPartition="$1"
|
||||
cd "$ChosenPartition"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Get host board information
|
||||
HostArchitecture=$(uname -m)
|
||||
HostOSInfo=$(cat /etc/os-release | sed 's/;/!/g')
|
||||
HostOS=$(echo "$HostOSInfo" | grep "PRETTY_NAME" | cut -d= -f2 | xargs)
|
||||
|
||||
if [[ "$HostArchitecture" == *"x86"* || "$HostArchitecture" == *"amd64"* ]]; then
|
||||
# X86 or X86_64 system -- use dmidecode
|
||||
HostModel=$(dmidecode -t1 | grep 'Product Name' -m 1 | cut -d: -f2 | xargs)
|
||||
HostManufacturer=$(dmidecode -t1 | grep 'Manufacturer' -m 1 | cut -d: -f2 | xargs)
|
||||
else
|
||||
# ARM system
|
||||
if [ -e /proc/device-tree/model ]; then
|
||||
HostModel=$(tr -d '\0' </proc/device-tree/model)
|
||||
if [[ "$HostModel" == *"Raspberry Pi"* ]]; then
|
||||
HostManufacturer="Raspberry Pi Foundation"
|
||||
elif [[ "$HostModel" == *"Tinker Board"* ]]; then
|
||||
HostManufacturer="ASUSTeK"
|
||||
else
|
||||
HostManufacturer=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "$HostModel" ]; then
|
||||
Print_Style "Board information: Manufacturer: $HostManufacturer - Model: $HostModel - Architecture: $HostArchitecture - OS: $HostOS" "$YELLOW"
|
||||
else
|
||||
Print_Style "Board information: Architecture: $HostArchitecture - OS: $HostOS" "$YELLOW"
|
||||
fi
|
||||
# Install required components
|
||||
Print_Style "Fetching required components ..." "$YELLOW"
|
||||
|
||||
# Test for apt first (all Debian based distros)
|
||||
if [ -n "$(which apt)" ]; then
|
||||
# Check if we are on a Raspberry Pi
|
||||
if [[ $HostModel == *"Raspberry Pi"* ]]; then
|
||||
# Check for vcgencmd (measures clock speeds)
|
||||
if [ -z "$(which vcgencmd)" ]; then Install_Apt_Package "libraspberrypi-bin"; fi
|
||||
fi
|
||||
|
||||
# Retrieve dependencies -- these are all bare minimum system tools to identify the hardware (many will already be built in)
|
||||
if [ -z "$(which lshw)" ]; then Install_Apt_Package "lshw"; fi
|
||||
if [ -z "$(which udevadm)" ]; then Install_Apt_Package "udev"; fi
|
||||
if [ -z "$(which lspci)" ]; then Install_Apt_Package "pciutils"; fi
|
||||
if [ -z "$(which lsusb)" ]; then Install_Apt_Package "usbutils"; fi
|
||||
if [ -z "$(which lsscsi)" ]; then Install_Apt_Package "lsscsi"; fi
|
||||
if [ -z "$(which bc)" ]; then Install_Apt_Package "bc"; fi
|
||||
if [ -z "$(which curl)" ]; then Install_Apt_Package "curl"; fi
|
||||
if [ -z "$(which hwinfo)" ]; then Install_Apt_Package "hwinfo"; fi
|
||||
if [ -z "$(which hdparm)" ]; then Install_Apt_Package "hdparm"; fi
|
||||
if [ -z "$(which dmidecode)" ]; then Install_Apt_Package "dmidecode"; fi
|
||||
if [ -z "$(which fio)" ]; then Install_Apt_Package "fio"; fi
|
||||
if [ -z "$(which iozone)" ]; then Install_Apt_Package "iozone3"; fi
|
||||
if [ -z "$(which nvme)" ]; then Install_Apt_Package "nvme-cli"; fi
|
||||
if [ -z "$(which smartctl)" ]; then Install_Apt_Package "smartmontools"; fi
|
||||
if [ -z "$(which sdparm)" ]; then Install_Apt_Package "sdparm"; fi
|
||||
if [ -z "$(which xxd)" ]; then Install_Apt_Package "xxd"; fi
|
||||
|
||||
DpkgArch=$(dpkg --print-architecture)
|
||||
if [ -z "$(which iozone)" ]; then
|
||||
# Attempt to install iozone from package
|
||||
if [[ "$HostArchitecture" == *"armv7"* || "$HostArchitecture" == *"armhf"* ]]; then
|
||||
curl -s -o iozone3.deb http://ftp.us.debian.org/debian/pool/non-free/i/iozone3/iozone3_429-3+b1_armhf.deb
|
||||
dpkg --install iozone3.deb
|
||||
rm iozone3.deb
|
||||
elif [[ "$DpkgArch" == *"arm64"* || "$HostArchitecture" == *"aarch64"* || "$HostArchitecture" == *"arm64"* ]]; then
|
||||
curl -s -o iozone3.deb http://ftp.us.debian.org/debian/pool/non-free/i/iozone3/iozone3_429-3+b1_arm64.deb
|
||||
dpkg --install iozone3.deb
|
||||
rm iozone3.deb
|
||||
elif [[ "$DpkgArch" == *"armel"* ]]; then
|
||||
curl -s -o iozone3.deb http://ftp.us.debian.org/debian/pool/non-free/i/iozone3/iozone3_429-3+b1_armel.deb
|
||||
dpkg --install iozone3.deb
|
||||
rm iozone3.deb
|
||||
elif [[ "$HostArchitecture" == *"x86_64"* || "$HostArchitecture" == *"amd64"* ]]; then
|
||||
curl -s -o iozone3.deb http://ftp.us.debian.org/debian/pool/non-free/i/iozone3/iozone3_429-3+b1_amd64.deb
|
||||
dpkg --install iozone3.deb
|
||||
rm iozone3.deb
|
||||
elif [[ "$HostArchitecture" == *"i386"* ]]; then
|
||||
curl -s -o iozone3.deb http://ftp.us.debian.org/debian/pool/non-free/i/iozone3/iozone3_429-3+b1_i386.deb
|
||||
dpkg --install iozone3.deb
|
||||
rm iozone3.deb
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test if we were able to install iozone3 from a package and don't install build-essential if we were
|
||||
if [ -z "$(which iozone)" ]; then
|
||||
Install_Apt_Package "build-essential"
|
||||
fi
|
||||
|
||||
DpkgTest=$(dpkg -s libxml-dumper-perl 2>&1 | grep Status | grep installed)
|
||||
if [ -z "$DpkgTest" ]; then Install_Apt_Package "libxml-dumper-perl"; fi
|
||||
|
||||
# Next test for Pac-Man (Arch Linux)
|
||||
elif [ -n "$(which pacman)" ]; then
|
||||
pacman -Syy
|
||||
pacman --needed --noconfirm -S \
|
||||
base-devel \
|
||||
bc \
|
||||
curl \
|
||||
dmidecode \
|
||||
fio \
|
||||
hdparm \
|
||||
lshw \
|
||||
lsscsi \
|
||||
pciutils \
|
||||
usbutils \
|
||||
nvme-cli \
|
||||
sdparm \
|
||||
vim
|
||||
|
||||
# Install iozone
|
||||
if ! command -v iozone; then
|
||||
echo "Please install iozone via the AUR for this script to work" >&2
|
||||
echo "https://aur.archlinux.org/packages/iozone/" >&2
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Check if running on a Raspberry Pi
|
||||
if [[ $HostModel == *"Raspberry Pi"* ]]; then
|
||||
if [ -z "$(which vcgencmd)" ]; then
|
||||
# Create soft link for vcgencmd
|
||||
ln -s /opt/vc/bin/vcgencmd /usr/local/bin
|
||||
fi
|
||||
fi
|
||||
else
|
||||
Print_Style "No package manager found!" "$RED"
|
||||
fi
|
||||
|
||||
if [ -z "$(which lsblk)" ]; then
|
||||
Print_Style "Unable to locate the utility lsblk. Please install lsblk for your distro!" "$RED"
|
||||
# Return to home directory
|
||||
exit 3
|
||||
fi
|
||||
|
||||
if [ -z "$(which fio)" ]; then
|
||||
Print_Style "Unable to locate the utility fio. Please install fio for your distro!" "$RED"
|
||||
# Return to home directory
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Get clock speeds
|
||||
if [[ "$HostArchitecture" == *"x86"* || "$HostArchitecture" == *"amd64"* ]]; then
|
||||
# X86 or X86_64 system -- use dmidecode
|
||||
HostCPUClock=$(dmidecode -t4 | grep -m 1 'Max Speed' | cut -d: -f2 | cut -d' ' -f2 | xargs)
|
||||
HostCoreClock=""
|
||||
HostRAMClock=$(dmidecode -t17 | grep -m 1 "Speed: " | cut -d' ' -f2 | xargs)
|
||||
else
|
||||
# Check for vcgencmd
|
||||
if [ -n "$(which vcgencmd)" ]; then
|
||||
HostConfig=$(vcgencmd get_config int)
|
||||
HostCPUClock=$(echo "$HostConfig" | grep -m 1 arm_freq= | cut -d= -f2 | xargs)
|
||||
if [ -z "$HostCPUClock" ]; then
|
||||
HostCPUClock=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq | xargs)
|
||||
HostCPUClock=$(echo "scale=0; $HostCPUClock / 1000" | bc)
|
||||
fi
|
||||
HostCoreClock=$(echo "$HostConfig" | grep -m 1 core_freq= | cut -d= -f2 | xargs)
|
||||
if [ -z "$HostCoreClock" ]; then
|
||||
HostCoreClock=$(echo "$HostConfig" | grep -m 1 gpu_freq= | cut -d= -f2 | xargs)
|
||||
fi
|
||||
if [ -z "$HostCoreClock" ]; then
|
||||
HostCoreClock=$(vcgencmd measure_clock core | cut -d= -f2 | xargs)
|
||||
HostCoreClock=$(echo "scale=0; $HostCoreClock / 1000000" | bc)
|
||||
fi
|
||||
HostRAMClock=$(echo "$HostConfig" | grep -m 1 sdram_freq= | cut -d= -f2 | xargs)
|
||||
if [ -z "$HostRAMClock" ]; then
|
||||
HostRAMClock=""
|
||||
fi
|
||||
else
|
||||
HostCPUClock=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
|
||||
HostCPUClock=$(echo "scale=0; $HostCPUClock / 1000" | bc)
|
||||
HostCoreClock=""
|
||||
HostRAMClock=""
|
||||
fi
|
||||
fi
|
||||
if [ -z "$HostRAMClock" ]; then
|
||||
Print_Style "Clock speeds: CPU: $HostCPUClock - Core: $HostCoreClock"
|
||||
else
|
||||
Print_Style "Clock speeds: CPU: $HostCPUClock - Core: $HostCoreClock - RAM: $HostRAMClock" "$YELLOW"
|
||||
fi
|
||||
|
||||
# Retrieve and build iozone
|
||||
if [ -z "$(which iozone)" ]; then
|
||||
if [ ! -f iozone/src/current/iozone ]; then
|
||||
Print_Style "Building iozone ..." "$YELLOW"
|
||||
DownloadURL=$(curl -N iozone.org | grep -m 1 -o 'src/current/iozone3_[^"]*')
|
||||
curl -s -o iozone.tar "http://www.iozone.org/$DownloadURL"
|
||||
tar -xf iozone.tar
|
||||
rm iozone.tar
|
||||
mv iozone3_* iozone
|
||||
cd iozone/src/current
|
||||
make --quiet linux-arm
|
||||
cd ../../..
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run sync to make sure all changes have been written to disk
|
||||
sync
|
||||
|
||||
if [ -z "$ChosenPartition" ]; then
|
||||
# User did not provide a partition/folder, continue with rootfs
|
||||
# --Get system boot drive information--
|
||||
# Find from mountpoint first
|
||||
BootDrive=$(findmnt -n -o SOURCE --target /)
|
||||
|
||||
# Find by matching device IDs to / next
|
||||
if [ -z "$BootDrive" ]; then
|
||||
RDEV=$(mountpoint -d /)
|
||||
|
||||
for file in /dev/*; do
|
||||
DeviceIDP1=$(stat --printf="0x%t" "$file")
|
||||
DeviceIDP2=$(stat --printf="0x%T" "$file")
|
||||
DeviceID=$(printf "%d:%d" "$DeviceIDP1" "$DeviceIDP2")
|
||||
if [ "$DeviceID" = "$RDEV" ]; then
|
||||
BootDrive=$file
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Fall back to finding from lsblk
|
||||
if [ -z "$BootDrive" ]; then
|
||||
BootDrive=$(lsblk -l | grep -v "0 part /boot" | grep -m 1 "0 part /" | awk 'NR==1{ print $1 }' | sed -e 's/\[\/.*\]//g')
|
||||
if [ -n "$BootDrive" ]; then
|
||||
BootDrive="/dev/"$BootDrive
|
||||
fi
|
||||
fi
|
||||
|
||||
# Fall back to finding from df
|
||||
if [ -z "$BootDrive" ]; then
|
||||
BootDrive=$(df -H | grep -m 1 boot | awk 'NR==1{ print $1 }' | sed -e 's/\[\/.*\]//g')
|
||||
fi
|
||||
else
|
||||
BootDrive=$(findmnt -n -o SOURCE --target "$ChosenPartition" | sed -e 's/\[\/.*\]//g')
|
||||
fi
|
||||
|
||||
# Detect BootDrive suffix
|
||||
BootDriveSuffix=$(echo "$BootDrive" | cut -d"/" -f3)
|
||||
if [ -z "$BootDriveSuffix" ]; then
|
||||
BootDriveSuffix=$(echo "$BootDrive" | cut -d"/" -f2)
|
||||
fi
|
||||
if [ -z "$BootDriveSuffix" ]; then
|
||||
BootDriveSuffix=$(echo "$BootDrive" | cut -d"/" -f1)
|
||||
fi
|
||||
if [ -z "$BootDriveSuffix" ]; then
|
||||
BootDriveSuffix="$BootDrive"
|
||||
fi
|
||||
|
||||
if [ -z "$ChosenPartition" ]; then
|
||||
Print_Style "System rootfs drive (/) has been detected as $BootDrive ($BootDriveSuffix)" "$YELLOW"
|
||||
else
|
||||
Print_Style "Chosen partition ($ChosenPartition) has been detected as $BootDrive ($BootDriveSuffix)" "$YELLOW"
|
||||
fi
|
||||
|
||||
Print_Style "Starting INXI hardware identification..." "$YELLOW"
|
||||
# Retrieve inxi hardware identification utility (https://github.com/smxi/inxi for more info)
|
||||
curl -s -o inxi https://raw.githubusercontent.com/smxi/inxi/master/inxi
|
||||
chmod +x inxi
|
||||
Test_inxi=$(./inxi -F -v8 -c0 -M -m -d -f -i -l -m -o -p -r -t -u -xxx 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
./inxi -v4 -d -c0 2>&1
|
||||
rm -f inxi
|
||||
|
||||
Print_Style "Running additional hardware identification tests..." "$YELLOW"
|
||||
Test_udevadm=$(udevadm info -w20 -a -n "$BootDrive" 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d' | grep -v 'info: invalid option')
|
||||
if [ -z "$Test_udevadm" ]; then
|
||||
echo "udevadm does not have wait option -- retrying..."
|
||||
Test_udevadm=$(udevadm info -a -n "$BootDrive" 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
Test_lsblk=$(lsblk -l -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_lshw=$(lshw 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_lsusb=$(lsusb 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_lsscsi=$(lsscsi -Lv 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_lscpu=$(lscpu 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_lspci=$(lspci -v 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_findmnt=$(findmnt -n 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_diskbyid=$(ls /dev/disk/by-id 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_df=$(df -h 2>&1 | sed 's/;/!/g')
|
||||
Test_cpuinfo=$(cat /proc/cpuinfo 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_dmesg=$(dmesg -Lnever 2>&1 | grep usb | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_fstab=$(cat /etc/fstab 2>&1 | sed 's/;/!/g')
|
||||
Test_dmidecode=$(dmidecode 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_hwinfo=$(hwinfo --arch --bios --block --bridge --disk --framebuffer --gfxcard --hub --ide --isapnp --listmd --memory --mmc-ctrl --monitor --netcard --partition --pci --pcmcia --pcmcia-ctrl --redasd --scsi --sound --storage-ctrl --sys --tape --usb --usb-ctrl 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Test_nvme=$(nvme list -o json 2>&1 | sed 's/\x0//g')
|
||||
#Test_nvme+=$(nvme show-regs "$BootDrive" -H 2>&1 | sed 's/;/!/g' | sed 's/\x0//g')
|
||||
Test_smartctl=$(smartctl -x "$BootDrive" 2>&1 | sed 's/;/!/g' | sed '/^[[:space:]]*$/d')
|
||||
Capacity=$(lsblk -l 2>&1 | grep "$BootDriveSuffix" -m 1 | awk 'NR==1{ print $4 }' | sed 's/,/./g')
|
||||
Print_Style "Additional hardware identification tests completed." "$YELLOW"
|
||||
|
||||
# Check for Micro SD / MMC card
|
||||
if [[ "$BootDrive" == *"mmcblk"* ]]; then
|
||||
# MicroSD hardware identification
|
||||
Print_Style "Starting MMC/SD identification..." "$YELLOW"
|
||||
|
||||
# Determine if MMC or Micro SD
|
||||
RootDrive=$(echo "$BootDrive" | cut -dp -f1 | cut -d/ -f3)
|
||||
MMCType=$(cat /sys/block/"$RootDrive"/device/type)
|
||||
|
||||
# Get card information
|
||||
Manufacturer=$(echo "$Test_udevadm" | grep -m 1 "manfid" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
if [ -z "$Manufacturer" ]; then
|
||||
Manufacturer=$(cat /sys/block/"$RootDrive"/device/manfid)
|
||||
Product=$(cat /sys/block/"$RootDrive"/device/type)
|
||||
Firmware=$(cat /sys/block/"$RootDrive"/device/fwrev)
|
||||
DateManufactured=$(cat /sys/block/"$RootDrive"/device/date)
|
||||
Model=$(cat /sys/block/"$RootDrive"/device/name)
|
||||
Version=$(cat /sys/block/"$RootDrive"/device/hwrev)
|
||||
#Vendor=$(cat /sys/block/"$RootDrive"/device/oemid)
|
||||
SSR=$(cat /sys/block/"$RootDrive"/device/ssr)
|
||||
SCR=$(cat /sys/block/"$RootDrive"/device/scr)
|
||||
CID=$(cat /sys/block/"$RootDrive"/device/cid)
|
||||
CSD=$(cat /sys/block/"$RootDrive"/device/csd)
|
||||
OCR=$(cat /sys/block/"$RootDrive"/device/ocr)
|
||||
else
|
||||
Product=$(echo "$Test_udevadm" | grep -m 1 "{type}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
Firmware=$(echo "$Test_udevadm" | grep -m 1 "{fwrev}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
DateManufactured=$(echo "$Test_udevadm" | grep -m 1 "date" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
Model=$(echo "$Test_udevadm" | grep -m 1 "{name}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
Version=$(echo "$Test_udevadm" | grep -m 1 "{hwrev}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
#Vendor=$(echo "$Test_udevadm" | grep -m 1 "oemid" | cut -d= -f3 | cut -d\" -f2 | xargs | xxd -r)
|
||||
SSR=$(echo "$Test_udevadm" | grep -m 1 "{ssr}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
SCR=$(echo "$Test_udevadm" | grep -m 1 "{scr}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
CID=$(echo "$Test_udevadm" | grep -m 1 "{cid}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
CSD=$(echo "$Test_udevadm" | grep -m 1 "{csd}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
OCR=$(echo "$Test_udevadm" | grep -m 1 "{ocr}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
fi
|
||||
|
||||
if [[ "$MMCType" == *"SD"* ]]; then
|
||||
# MicroSD hardware identification
|
||||
Print_Style "Starting SD card identification..." "$YELLOW"
|
||||
|
||||
HostSDClock=$(grep "actual clock" /sys/kernel/debug/mmc0/ios 2>/dev/null | awk '{printf("%0.1f", $3/1000000)}')
|
||||
|
||||
# Parse SSR status register
|
||||
SSRBinary=$(Get_Binary "$SSR")
|
||||
SSRAppClass=$(Get_Decimal "$(Get_Bits "$SSRBinary" 336 4 512)")
|
||||
SSRVideoClass=$(Get_Decimal "$(Get_Bits "$SSRBinary" 384 8 512)")
|
||||
SSRUHSClass=$(Get_Decimal "$(Get_Bits "$SSRBinary" 396 4 512)")
|
||||
SSRSpeedClass=$(Get_Decimal "$(Get_Bits "$SSRBinary" 440 8 512)")
|
||||
|
||||
# Parse CID status register
|
||||
CIDBinary=$(Get_Binary "$CID")
|
||||
CIDMID=$(Get_Hex "$(Get_Bits "$CIDBinary" 120 8 128)")
|
||||
CIDMDateM=$(Get_Decimal "$(Get_Bits "$CIDBinary" 8 4 128)")
|
||||
CIDMDateY=$(Get_Decimal "$(Get_Bits "$CIDBinary" 12 8 128)")
|
||||
CIDMDate="$CIDMDateM/20$CIDMDateY"
|
||||
CIDOID=$(Get_Text "$(Get_Bits "$CIDBinary" 104 16 128)")
|
||||
CIDPNM=$(Get_Text "$(Get_Bits "$CIDBinary" 64 40 128)")
|
||||
CIDPRVHW=$(Get_Hex "$(Get_Bits "$CIDBinary" 60 4 128)")
|
||||
CIDPRVFW=$(Get_Hex "$(Get_Bits "$CIDBinary" 56 4 128)")
|
||||
CIDPRV="$CIDPRVHW.$CIDPRVFW"
|
||||
|
||||
# Parse CSD status register
|
||||
CSDBinary=$(Get_Binary "$CSD")
|
||||
CSDMID=$(Get_Hex "$(Get_Bits "$CSDBinary" 120 8 128)")
|
||||
Print_Style "Card CSD status register: MID: $CIDMID OID: $CIDOID PNM: $CIDPNM PRV: $CIDPRV MDATE: $CIDMDate" "$YELLOW"
|
||||
|
||||
# Parse SCR status register
|
||||
SCRBinary=$(Get_Binary "$SCR")
|
||||
SCRSDSpec=$(Get_Decimal "$(Get_Bits "$SCRBinary" 56 4 64)")
|
||||
SCRSDSpec3=$(Get_Decimal "$(Get_Bits "$SCRBinary" 47 1 64)")
|
||||
SCRSDSpec4=$(Get_Decimal "$(Get_Bits "$SCRBinary" 42 1 64)")
|
||||
SCRSDSpecX=$(Get_Decimal "$(Get_Bits "$SCRBinary" 38 4 64)")
|
||||
|
||||
# Get SD physical layer specification version
|
||||
if [ "$SCRSDSpecX" == "2" ]; then # 6.XX
|
||||
SCRSDSpecVer="6"
|
||||
elif [ "$SCRSDSpecX" == "1" ]; then # 5.XX
|
||||
SCRSDSpecVer="5"
|
||||
elif [ "$SCRSDSpec4" == "1" ]; then # 4.XX
|
||||
SCRSDSpecVer="4"
|
||||
elif [ "$SCRSDSpec3" == "1" ]; then # 3.XX
|
||||
SCRSDSpecVer="3"
|
||||
elif [ "$SCRSDSpec" == "2" ]; then # 2.00
|
||||
SCRSDSpecVer="2"
|
||||
elif [ "$SCRSDSpec" == "1" ]; then # 1.10
|
||||
SCRSDSpecVer="1.1"
|
||||
elif [ "$SCRSDSpec" == "0" ]; then # 1.0
|
||||
SCRSDSpecVer="1"
|
||||
fi
|
||||
Print_Style "Card SCR status register: SD Physical Version Specification: $SCRSDSpecVer" "$YELLOW"
|
||||
|
||||
# Check for known manufacturers
|
||||
case "$Manufacturer" in
|
||||
0x000001)
|
||||
Manufacturer="Panasonic"
|
||||
;;
|
||||
0x000002)
|
||||
Manufacturer="Toshiba"
|
||||
;;
|
||||
0x000003)
|
||||
Manufacturer="SanDisk"
|
||||
;;
|
||||
0x000008)
|
||||
Manufacturer="Silicon Power"
|
||||
;;
|
||||
0x000018)
|
||||
Manufacturer="Infineon"
|
||||
;;
|
||||
0x00001b)
|
||||
Manufacturer="Samsung"
|
||||
;;
|
||||
0x00001d)
|
||||
Manufacturer="Corsair/AData"
|
||||
;;
|
||||
0x000027)
|
||||
Manufacturer="Phison"
|
||||
;;
|
||||
0x000028)
|
||||
Manufacturer="Lexar"
|
||||
;;
|
||||
0x000030)
|
||||
Manufacturer="SanDisk"
|
||||
;;
|
||||
0x000031)
|
||||
Manufacturer="Silicon Power"
|
||||
;;
|
||||
0x000033)
|
||||
Manufacturer="STMicroelectronics"
|
||||
;;
|
||||
0x000041)
|
||||
Manufacturer="Kingston"
|
||||
;;
|
||||
0x000045)
|
||||
Manufacturer="Team Group"
|
||||
;;
|
||||
0x00006f)
|
||||
Manufacturer="STMicroelectronics"
|
||||
;;
|
||||
0x000073)
|
||||
Manufacturer="Hama"
|
||||
;;
|
||||
0x000074)
|
||||
Manufacturer="Transcend"
|
||||
;;
|
||||
0x000076)
|
||||
Manufacturer="Patriot"
|
||||
;;
|
||||
0x000082)
|
||||
Manufacturer="Sony"
|
||||
;;
|
||||
0x000092)
|
||||
Manufacturer="Sony"
|
||||
;;
|
||||
0x00009c)
|
||||
Manufacturer="Sony"
|
||||
;;
|
||||
0x00009e)
|
||||
Manufacturer="Lexar"
|
||||
;;
|
||||
0x00009f)
|
||||
Manufacturer="Texas Instruments"
|
||||
;;
|
||||
0x0000ff)
|
||||
Manufacturer="Netac"
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
|
||||
# Identify card classifications
|
||||
Class=""
|
||||
if [[ $SSRAppClass -gt 0 ]]; then
|
||||
Class="A$SSRAppClass"
|
||||
fi
|
||||
case "$SSRSpeedClass" in
|
||||
0)
|
||||
Class="$Class Class 0"
|
||||
;;
|
||||
1)
|
||||
Class="$Class Class 2"
|
||||
;;
|
||||
2)
|
||||
Class="$Class Class 4"
|
||||
;;
|
||||
3)
|
||||
Class="$Class Class 6"
|
||||
;;
|
||||
4)
|
||||
Class="$Class Class 10"
|
||||
;;
|
||||
*)
|
||||
Class="$Class ?"
|
||||
;;
|
||||
esac
|
||||
if [[ $SSRVideoClass -gt 0 ]]; then
|
||||
Class="$Class V$SSRVideoClass"
|
||||
fi
|
||||
if [[ $SSRUHSClass -gt 0 ]]; then
|
||||
Class="$Class U$SSRUHSClass"
|
||||
fi
|
||||
Class=$(echo "$Class" | xargs)
|
||||
Print_Style "MicroSD information: Clock Speed: $HostSDClock - Manufacturer: $Manufacturer - Model: $Model - Vendor: $Vendor - Product: $Product - HW Version: $Version - FW Version: $Firmware - Date Manufactured: $DateManufactured - Class: $Class" "$YELLOW"
|
||||
elif [[ "$MMCType" == *"MMC"* ]]; then
|
||||
# Attempt to identify MMC device
|
||||
|
||||
Print_Style "MMC Detected. Identifying..." "$YELLOW"
|
||||
|
||||
HostSDClock=""
|
||||
|
||||
case "$Manufacturer" in
|
||||
0x000000)
|
||||
Manufacturer="SanDisk"
|
||||
;;
|
||||
0x000002)
|
||||
Manufacturer="Kingston/SanDisk"
|
||||
;;
|
||||
0x000003)
|
||||
Manufacturer="Toshiba"
|
||||
;;
|
||||
0x000011)
|
||||
Manufacturer="Toshiba"
|
||||
;;
|
||||
0x000015)
|
||||
Manufacturer="Samsung/SanDisk/LG"
|
||||
;;
|
||||
0x000037)
|
||||
Manufacturer="KingMax"
|
||||
;;
|
||||
0x000044)
|
||||
Manufacturer="SanDisk"
|
||||
;;
|
||||
0x000090)
|
||||
Manufacturer="SK Hynix"
|
||||
;;
|
||||
0x00002c)
|
||||
Manufacturer="Kingston"
|
||||
;;
|
||||
0x000070)
|
||||
Manufacturer="Kingston"
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
|
||||
# Get capacity
|
||||
DriveCapacity=$(cat /sys/block/"$RootDrive"/device/emmc_total_size)
|
||||
if [ -n "$DriveCapacity" ]; then
|
||||
if [ "$DriveCapacity" -eq "$DriveCapacity" ] 2>/dev/null; then
|
||||
Capacity=$DriveCapacity"G"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse CSD register
|
||||
CSDBinary=$(Get_Binary "$CSD")
|
||||
CSDSpecVersion=$(Get_Decimal "$(Get_Bits "$CSDBinary" 122 4 128)")
|
||||
|
||||
# Parse CID register
|
||||
CIDBinary=$(Get_Binary "$CID")
|
||||
CIDCBX=$(Get_Decimal "$(Get_Bits "$CIDBinary" 112 1 128)")
|
||||
|
||||
# Check CBX value to see if MMC is embedded or removable
|
||||
case "$CIDCBX" in
|
||||
0)
|
||||
Product="MMC"
|
||||
Class="MMC v$CSDSpecVersion (Card)"
|
||||
;;
|
||||
1)
|
||||
Product="eMMC"
|
||||
Class="eMMC v$CSDSpecVersion (Embedded)"
|
||||
;;
|
||||
10)
|
||||
Product="MMC"
|
||||
Class="MMC v$CSDSpecVersion (POP)"
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
|
||||
Print_Style "MMC Type: $Class - Manufacturer: $Manufacturer - Model: $Model - Size: $Capacity" "$YELLOW"
|
||||
|
||||
fi
|
||||
else
|
||||
# Not a MicroSD card
|
||||
Print_Style "Starting mass storage device identification..." "$YELLOW"
|
||||
|
||||
HDParmInfo=$(hdparm -Ii "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
if [ -z "$HDParmInfo" ]; then
|
||||
HDParmInfo=$(hdparm -I "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
Test_hdparm=$(echo "$HDParmInfo")
|
||||
|
||||
HostSDClock=""
|
||||
DateManufactured=""
|
||||
|
||||
# Attempt to identify drive model
|
||||
Model=$(echo "$Test_udevadm" | grep -m 1 "{model}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
#Vendor=$(echo "$Test_udevadm" | grep -m 1 "{vendor}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
Manufacturer=$(echo "$Test_udevadm" | grep -m 1 "{manufacturer}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
|
||||
case "$Model" in
|
||||
"ASM105x")
|
||||
# This is the ASMedia USB TO 2.5" SATA adapter chipset
|
||||
Product="SSD"
|
||||
FormFactor="2.5"
|
||||
Class="SSD (2.5\" SATA)"
|
||||
Adapter="ASMedia ASM105x"
|
||||
Model=
|
||||
Manufacturer=
|
||||
;;
|
||||
"SABRENT")
|
||||
# This is the Sabrent USB TO 2.5" SATA adapter chipset
|
||||
Product="SSD"
|
||||
FormFactor="2.5"
|
||||
Class="SSD (2.5\" SATA)"
|
||||
Adapter="Sabrent"
|
||||
Model=
|
||||
Manufacturer=
|
||||
;;
|
||||
"2105")
|
||||
# ASMedia adapter 2105
|
||||
Product="SSD"
|
||||
FormFactor="2.5"
|
||||
Class="SSD (2.5\" SATA)"
|
||||
Adapter="ASMedia 2105"
|
||||
Model=
|
||||
Manufacturer=
|
||||
;;
|
||||
"2115")
|
||||
# ASMedia adapter 2115
|
||||
Product="SSD"
|
||||
FormFactor="2.5"
|
||||
Class="SSD (2.5\" SATA)"
|
||||
Adapter="ASMedia 2115"
|
||||
Model=
|
||||
Manufacturer=
|
||||
;;
|
||||
"USB 3.0 Device")
|
||||
# ASMedia USB to SATA adapter (generic)
|
||||
Product="SSD"
|
||||
FormFactor="2.5"
|
||||
Class="SSD (2.5\" SATA)"
|
||||
Adapter="ASMedia 3.0 Generic"
|
||||
Model=
|
||||
Manufacturer=
|
||||
;;
|
||||
"AQ3120")
|
||||
# Geekworm x855
|
||||
Product="SSD"
|
||||
FormFactor="2.5"
|
||||
Class="SSD (mSATA)"
|
||||
Adapter="Geekworm x855"
|
||||
Model=
|
||||
Manufacturer=
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
if [ -z "$Model" ]; then
|
||||
Model=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | awk 'NR==1{ print $3 }' | grep "_" | cut -d_ -f2 | xargs)
|
||||
fi
|
||||
if [ -z "$Model" ]; then
|
||||
Model=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | awk 'NR==1{ print $3 }' | grep " " | cut -d" " -f2 | xargs)
|
||||
fi
|
||||
if [ -z "$Model" ]; then
|
||||
Model=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | awk 'NR==1{ print $3$4$5$6$7$8$9 }' | xargs)
|
||||
fi
|
||||
if [ -z "$Model" ]; then
|
||||
Model=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | awk 'NR==1{ print $3$4$5$6$7$8$9 }' | xargs)
|
||||
fi
|
||||
|
||||
# Attempt to identify drive manufacturer
|
||||
if [ -z "$Manufacturer" ]; then
|
||||
Manufacturer=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | grep "_" | awk 'NR==1{ print $3 }' | cut -d_ -f1 | xargs)
|
||||
fi
|
||||
if [ -z "$Manufacturer" ]; then
|
||||
Manufacturer=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | grep " " | awk 'NR==1{ print $3 }' | cut -d" " -f1 | xargs)
|
||||
fi
|
||||
if [ -z "$Manufacturer" ]; then
|
||||
Manufacturer=$(echo "$Test_hdparm" | grep -m 1 "Model Number:" | awk 'NR==1{ print $3 }' | xargs)
|
||||
fi
|
||||
|
||||
# Identify drive type, form factor
|
||||
if [ -z "$FormFactor" ]; then
|
||||
FormFactor=$(echo "$Test_hdparm" | grep -m 1 "Form Factor:" | cut -d: -f2 | cut -d' ' -f1 | xargs)
|
||||
if [ -z "$FormFactor" ]; then
|
||||
FormFactor="2.5"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Attempt to get drive capacity
|
||||
DriveCapacity=$(echo "$Test_hdparm" | grep -m 1 "device size with M = 1000*" | cut -d\( -f2 | cut -d' ' -f1 | xargs)
|
||||
if [ -n "$DriveCapacity" ]; then
|
||||
if [ "$DriveCapacity" -eq "$DriveCapacity" ] 2>/dev/null; then
|
||||
Capacity=$DriveCapacity"G"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Attempt to identify drive type
|
||||
DriveType=$(echo "$Test_hdparm" | grep -m 1 "Nominal Media Rotation Rate:" | cut -d: -f2 | xargs)
|
||||
case "$DriveType" in
|
||||
5400 | 7200 | 10000)
|
||||
Product="HDD"
|
||||
Class="HDD ($FormFactor\" SATA)"
|
||||
;;
|
||||
"Solid State Device")
|
||||
Product="SSD"
|
||||
Class="SSD ($FormFactor\" SATA)"
|
||||
;;
|
||||
*)
|
||||
Product="USB Flash"
|
||||
Class="USB Flash Drive"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Identify hardware and firmware versions of drive
|
||||
Version=$(echo "$Test_udevadm" | grep -m 1 "{version}" | cut -d= -f3 | cut -d\" -f2 | xargs)
|
||||
Firmware=$(echo "$Test_hdparm" | grep -m 1 "Firmware Revision:" | awk 'NR==1{ print $3$4$5$6 }')
|
||||
if [ -n "$Firmware" ]; then
|
||||
Firmware=$(echo "$Test_hdparm" | grep -m 1 "Firmware Revision:" | awk 'NR==1{ print $3$4$5$6 }')
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run HDParm tests
|
||||
Print_Style "Running HDParm tests ..." "$YELLOW"
|
||||
sync
|
||||
sync
|
||||
HDParm=$(hdparm -Tt --direct "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
if [ -z "$HDParm" ]; then
|
||||
HDParm=$(hdparm -Tt "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
if [ -z "$HDParm" ]; then
|
||||
HDParm=$(hdparm -T --direct "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
if [ -z "$HDParm" ]; then
|
||||
HDParm=$(hdparm -T "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
if [ -z "$HDParm" ]; then
|
||||
HDParm=$(hdparm -t --direct "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
if [ -z "$HDParm" ]; then
|
||||
HDParm=$(hdparm -t "$BootDrive" 2>/dev/null | sed '/^[[:space:]]*$/d')
|
||||
fi
|
||||
Print_Style "$HDParm" "$NORMAL"
|
||||
HDParmDisk=$(echo "$HDParm" | grep "disk reads:" | awk 'NR==1{ print $11 }' | sed 's/;/!/g')
|
||||
HDParmDiskUnit=$(echo "$HDParm" | grep "disk reads:" | awk 'NR==1{ print $12 }' | sed 's/;/!/g')
|
||||
HDParmCached=$(echo "$HDParm" | grep "cached reads:" | awk 'NR==1{ print $11 }' | sed 's/;/!/g')
|
||||
HDParmCachedUnit=$(echo "$HDParm" | grep "disk reads:" | awk 'NR==1{ print $12 }' | sed 's/;/!/g')
|
||||
Print_Style "HDParm: $HDParmDisk $HDParmDiskUnit - HDParmCached: $HDParmCached $HDParmCachedUnit" "$YELLOW"
|
||||
|
||||
# Run DD tests
|
||||
Print_Style "Running dd tests ..." "$YELLOW"
|
||||
sync
|
||||
sync
|
||||
DDWrite=$(dd if=/dev/zero of=test bs=4k count=130k conv=fsync 2>&1 | sed '/^[[:space:]]*$/d')
|
||||
DDWriteResult=$(echo "$DDWrite" | tail -n 1 | awk 'NR==1{ print $(NF-1) }' | sed 's/,/./g' | sed 's/s,//g')
|
||||
DDWriteUnit=$(echo "$DDWrite" | tail -n 1 | awk 'NR==1{ print $(NF) }' | sed 's/,/./g' | sed 's/s,//g')
|
||||
|
||||
echo "$DDWrite"
|
||||
Print_Style "DD Write Speed: $DDWriteResult $DDWriteUnit" "$YELLOW"
|
||||
rm -f test
|
||||
|
||||
# Run fio tests
|
||||
Print_Style "Running fio write test ..." "$YELLOW"
|
||||
sync
|
||||
sync
|
||||
fio4kRandWrite=$(fio --minimal --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=80M --readwrite=randwrite | sed 's/;/!/g')
|
||||
fio4kRandWriteIOPS=$(echo "$fio4kRandWrite" | awk -F '!' '{print $49}')
|
||||
fio4kRandWriteSpeed=$(echo "$fio4kRandWrite" | awk -F '!' '{print $48}')
|
||||
rm -f test
|
||||
Print_Style "Running fio read test ..." "$YELLOW"
|
||||
sync
|
||||
sync
|
||||
fio4kRandRead=$(fio --minimal --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=80M --readwrite=randread | sed 's/;/!/g')
|
||||
fio4kRandReadIOPS=$(echo "$fio4kRandRead" | awk -F '!' '{print $8}')
|
||||
fio4kRandReadSpeed=$(echo "$fio4kRandRead" | awk -F '!' '{print $7}')
|
||||
Print_Style "FIO results - 4k RandWrite: $fio4kRandWriteIOPS IOPS ($fio4kRandWriteSpeed KB/s) - 4k RandRead: $fio4kRandReadIOPS IOPS ($fio4kRandReadSpeed KB/s)" "$YELLOW"
|
||||
rm -f test
|
||||
|
||||
# Run iozone tests
|
||||
Print_Style "Running iozone test ..." "$YELLOW"
|
||||
sync
|
||||
sync
|
||||
if [ -z "$(which iozone)" ]; then
|
||||
IOZone=$(iozone/src/current/./iozone -a -e -I -i 0 -i 1 -i 2 -s 80M -r 4k)
|
||||
else
|
||||
IOZone=$(iozone -a -e -I -i 0 -i 1 -i 2 -s 80M -r 4k)
|
||||
fi
|
||||
IO4kRandRead=$(echo "$IOZone" | tail -n 3 | awk 'NR==1{ print $7 }')
|
||||
IO4kRandWrite=$(echo "$IOZone" | tail -n 3 | awk 'NR==1{ print $8 }')
|
||||
IO4kRead=$(echo "$IOZone" | tail -n 3 | awk 'NR==1{ print $5 }')
|
||||
IO4kWrite=$(echo "$IOZone" | tail -n 3 | awk 'NR==1{ print $3 }')
|
||||
IOZone=$(echo "$IOZone" | sed '/^[[:space:]]*$/d' | grep -v 'Contrib\|Rhine\|Landherr\|Dunlap\|Blomberg\|Strecker\|Xue,\|Vikentsi\|Alexey')
|
||||
echo "$IOZone"
|
||||
Print_Style "RandRead: $IO4kRandRead - RandWrite: $IO4kRandWrite - Read: $IO4kRead - Write: $IO4kWrite" "$YELLOW"
|
||||
|
||||
# Calculate score
|
||||
Score=$(echo "scale=2; $DDWriteResult * 1024" | bc)
|
||||
ScratchPad=$(echo "scale=2; $fio4kRandReadIOPS * 4" | bc)
|
||||
Score=$(echo "scale=2; $Score + $ScratchPad" | bc)
|
||||
ScratchPad=$(echo "scale=2; $fio4kRandWriteIOPS * 10" | bc)
|
||||
Score=$(echo "scale=2; $Score + $ScratchPad" | bc)
|
||||
Score=$(echo "scale=2; $Score + $IO4kRead" | bc)
|
||||
Score=$(echo "scale=2; $Score + $IO4kWrite" | bc)
|
||||
ScratchPad=$(echo "scale=2; $IO4kRandRead * 4" | bc)
|
||||
Score=$(echo "scale=2; $Score + $ScratchPad" | bc)
|
||||
ScratchPad=$(echo "scale=2; $IO4kRandWrite * 10" | bc)
|
||||
Score=$(echo "scale=2; $Score + $ScratchPad" | bc)
|
||||
Score=$(echo "scale=0; $Score / 100" | bc)
|
||||
|
||||
# Get brand information
|
||||
Print_Style "Enter a description or note" $GREEN
|
||||
read -r -t 0.001 </dev/tty
|
||||
read -r -p 'Description: ' Brand </dev/tty
|
||||
|
||||
if [ -f /opt/idssys/dsmon/config.settings.inc ]; then
|
||||
source /opt/idssys/dsmon/config.settings.inc
|
||||
hostid=${SERVERMON_ID}
|
||||
else
|
||||
hostid=''
|
||||
fi
|
||||
hostname=$(hostname -f)
|
||||
|
||||
# Submit results
|
||||
Submit=$(curl -s -k -L --form "DDWriteSpeed=$DDWriteResult" --form "host=$hostid" --form "hostname=$hostname" --form "score=$Score" --form "HDParmDisk=$HDParmDisk" --form "HDParmCached=$HDParmCached" --form "fio4kRandWriteIOPS=$fio4kRandWriteIOPS" --form "fio4kRandReadIOPS=$fio4kRandReadIOPS" --form "fio4kRandWriteSpeed=$fio4kRandWriteSpeed" --form "fio4kRandReadSpeed=$fio4kRandReadSpeed" --form "IO4kRandRead=$IO4kRandRead" --form "IO4kRandWrite=$IO4kRandWrite" --form "IO4kRead=$IO4kRead" --form "IO4kWrite=$IO4kWrite" --form "Drive=$BootDrive" --form "Model=$Model" --form "Capacity=$Capacity" --form "Manufacturer=$Manufacturer" --form "Product=$Product" --form "Note=$Brand" --form "HostModel=$HostModel" --form "HostCPUClock=$HostCPUClock" --form "HostCoreClock=$HostCoreClock" --form "HostRAMClock=$HostRAMClock" --form "HostArchitecture=$HostArchitecture" --form "HostOS=$HostOS" --form "HostManufacturer=$HostManufacturer" https://www.scity.us/storage_process.php)
|
||||
if [ "$(echo "$Submit" | grep '420')" != "" ]; then
|
||||
Print_Style "Result submitted successfully" "$GREEN"
|
||||
else
|
||||
Print_Style "ERROR: Result submission failed" "$RED"
|
||||
fi
|
||||
|
||||
# Display results
|
||||
printf "\n$BRIGHT$UNDERLINE%-25s %-25s %-25s\n" " Category" " Test" ' Result '"$NORMAL$CYAN"
|
||||
printf "%-25s %-25s %-25s\n" "HDParm" "Disk Read" "$HDParmDisk $HDParmDiskUnit"
|
||||
printf "%-25s %-25s %-25s\n" "HDParm" "Cached Disk Read" "$HDParmCached $HDParmCachedUnit"
|
||||
printf "%-25s %-25s %-25s\n" "DD" "Disk Write" "$DDWriteResult $DDWriteUnit"
|
||||
printf "%-25s %-25s %-25s\n" "FIO" "4k random read" "$fio4kRandReadIOPS IOPS ($fio4kRandReadSpeed KB/s)"
|
||||
printf "%-25s %-25s %-25s\n" "FIO" "4k random write" "$fio4kRandWriteIOPS IOPS ($fio4kRandWriteSpeed KB/s)"
|
||||
printf "%-25s %-25s %-25s\n" "IOZone" "4k read" "$IO4kRead KB/s"
|
||||
printf "%-25s %-25s %-25s\n" "IOZone" "4k write" "$IO4kWrite KB/s"
|
||||
printf "%-25s %-25s %-25s\n" "IOZone" "4k random read" "$IO4kRandRead KB/s"
|
||||
printf "%-25s %-25s %-25s\n" "IOZone" "4k random write" "$IO4kRandWrite KB/s"
|
||||
printf "\n$BRIGHT$MAGENTA$UNDERLINE%-25s %-25s %-25s\n" " " "Score: $Score" " "
|
||||
echo ""
|
||||
|
||||
# Return to home directory
|
||||
cd ~ || return
|
||||
2
test.sh
2
test.sh
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
|
||||
|
||||
echo 'yes'
|
||||
|
||||
36
uninstall-dsmon.sh
Executable file
36
uninstall-dsmon.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
#source /opt/idssys/defaults/colors.inc
|
||||
#source /opt/idssys/defaults/default.inc
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}DSmon Removal Script${idsCL[Default]}"
|
||||
|
||||
|
||||
do_with_root set -eu
|
||||
do_with_root rm -f /usr/local/bin/dsmon
|
||||
do_with_root rm -Rf /opt/idssys/dsmon
|
||||
|
||||
|
||||
if [ -d "/opt/idssys" ]; then
|
||||
IDSSYSF="`ls -l /opt/idssys/ | grep -c ^d`"
|
||||
if [ "$IDSSYSF" = 2 ]; then
|
||||
do_with_root rm -Rf /opt/idssys/defaults
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightRed]}DSmon has been Removed${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
@@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
|
||||
@@ -2,8 +2,13 @@
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
#source /opt/idssys/defaults/colors.inc
|
||||
#source /opt/idssys/defaults/default.inc
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://scity.xyz/defaultinc)"
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
else APTFUNC="${ATYPE}"
|
||||
fi
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}NodeMgmt Removal Script${idsCL[Default]}"
|
||||
|
||||
|
||||
do_with_root set -eu
|
||||
rm -f /usr/local/bin/nodemgmt
|
||||
rm -Rf /opt/idssys/nodemgmt
|
||||
|
||||
IDSSYSF="`ls -l /opt/idssys/ | grep -c ^d`"
|
||||
if [ "$IDSSYSF" = 2 ]; then
|
||||
rm -Rf /opt/idssys/defaults
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${idsCL[LightRed]}NodeMgmt has been Removed${idsCL[Default]}"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
67
update-dns.sh
Executable file
67
update-dns.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
if [ -f /etc/netplan/eth0.yaml ]; then
|
||||
netfile=/etc/netplan/eth0.yaml
|
||||
elif [ -f /etc/netplan/network.yaml ]; then
|
||||
netfile=/etc/netplan/network.yaml
|
||||
elif [ -f /etc/network/interfaces ]; then
|
||||
netfile=/etc/network/interfaces
|
||||
else
|
||||
echo -e "No network configs found\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat ${netfile}
|
||||
echo
|
||||
|
||||
chmod 0600 ${netfile}
|
||||
|
||||
read -p "Do you wish to continue changing the DNS? (Y/n) " choice
|
||||
case "$choice" in
|
||||
[Nn])
|
||||
echo -e "${Green}The DNS servers have NOT been updated${Color_Off}"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
* ) if [ -f /etc/netplan/eth0.yaml ] || [ -f /etc/netplan/network.yaml ]; then
|
||||
# if [ "${1}" = "offsite" ]; then
|
||||
sed -i 's/10.2.1.2,10.10.10.5/10.2.1.6,10.2.1.5/g' ${netfile}
|
||||
# sed -i 's/127.0.0.1,10.10.10.5/127.0.0.1,10.2.1.6/g' ${netfile}
|
||||
# else
|
||||
sed -i 's/10.10.10.5,10.2.1.2/10.10.10.10,10.10.10.11/g' ${netfile}
|
||||
sed -i 's/10.10.10.11,10.10.10.10/10.10.10.10,10.10.10.11/g' ${netfile}
|
||||
# sed -i 's/127.0.0.1,10.10.10.10,10.2.1.2/127.0.0.1,10.10.10.10/g' ${netfile}
|
||||
# sed -i 's/127.0.0.1,10.10.10.11,10.2.1.2/127.0.0.1,10.10.10.11/g' ${netfile}
|
||||
# fi
|
||||
|
||||
/usr/sbin/netplan apply
|
||||
|
||||
else
|
||||
# if [ "${1}" = "offsite" ]; then
|
||||
sed -i 's/10.2.1.2 10.10.10.5/10.2.1.6 10.2.1.5/g' ${netfile}
|
||||
# else
|
||||
sed -i 's/10.10.10.5 10.2.1.2/10.10.10.11 10.10.10.10/g' ${netfile}
|
||||
sed -i 's/10.10.10.11 10.10.10.10/10.10.10.10 10.10.10.11/g' ${netfile}
|
||||
# fi
|
||||
|
||||
/usr/sbin/service networking restart
|
||||
|
||||
fi
|
||||
|
||||
cat ${netfile}
|
||||
|
||||
echo -e "${Green}The DNS servers have been updated${Color_Off}"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo
|
||||
|
||||
exit 0
|
||||
22
vcenter-ssl-update.sh
Executable file
22
vcenter-ssl-update.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper script for install, for easier execution via URL.
|
||||
|
||||
if [ -d /opt/idssys/defaults ]; then
|
||||
source /opt/idssys/defaults/colors.inc
|
||||
source /opt/idssys/defaults/default.inc
|
||||
else
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/colorsinc)"
|
||||
source /dev/stdin <<< "$(curl -sL http://go.scity.us/defaultinc)"
|
||||
fi
|
||||
|
||||
|
||||
if [ "$EUID" -ne 0 ]; then APTFUNC="sudo ${ATYPE}"
|
||||
else APTFUNC="${ATYPE}"
|
||||
fi
|
||||
echo ""
|
||||
echo -e "${idsCL[LightGreen]}vCenter SSL Update Script${idsCL[Default]}"
|
||||
|
||||
/usr/lib/vmware-vmca/bin/certificate-managers
|
||||
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user