Created
September 20, 2020 09:16
-
-
Save C00kiie/e393b24293a59032afeae6f458770049 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# script: sas3/sas4 quick diagnoistics | |
## Author: Tyr4n7 | |
###### To Valahala! | |
separator_bar="----------------------------------------------------------------------------------------------"; | |
## check max_users ## | |
users_count=$(mysql -u sas -psas123 -s -N sas4 -e "select count(*) as c from sas_users" 2>/dev/null); # default passwords for sas4 | |
echo "SAS4 Current users: $users_count"; | |
## get license and expiration and max users ## | |
php -r '$sas=new \SAS4; $license = $sas->getLicense();echo "expiration: ".$license["exp"] . "\n"; echo "max_users: ". $license["mu"]." \n";' | |
#### print dmesg at the level of errors and warnings #### | |
echo "DMESG AT LEVEL ERROR/WARNING" | |
echo $separator_bar; | |
sudo dmesg --level err | |
echo $separator_bar; | |
#### checking hardware capacity issues #### | |
echo "[*] Available memory:"; | |
free -h | |
echo $separator_bar; | |
echo "[*] Storage unit diganoists:"; | |
echo "[*] Left space in drives:"; | |
df -kh; | |
echo $separator_bar; | |
#### Check if SAS processes are running ##### | |
#echo "[*] Which SAS processes are running?"; | |
#echo -ne "Process_FILE = > PID\n"; | |
#ps aux | grep "sas_" | uniq | awk '{print $11 " => "$2}'; | |
#echo $separator_bar; | |
############ mysqld & apache2 | |
echo "[*] Checking other services .. " | |
echo $separator_bar; | |
echo "[*] Is mysql running?" | |
mysqld_path="/run/mysqld/mysqld.pid" | |
mysqld_=$(cat $mysqld_path &> /dev/null) | |
if [ $? -eq 0 ]; | |
then | |
mysqld_=$(cat $mysqld_path); | |
echo "[*] Yes /var/mysqld/mysqld.pid => $mysqld_" | |
else | |
echo "[*] No" | |
fi | |
echo $separator_bar; | |
echo "[*] Is Apache2 running?" | |
apache2_path="/run/mysqld/mysqld.pid" | |
apache2d=$(cat $apache2_path &> /dev/null) | |
if [ $? -eq 0 ]; | |
then | |
apache2d=$(cat $mysqld_path); | |
echo "[*] Yes /var/run/apache2/apache2.pid => $apache2d" | |
else | |
echo "[*] No" | |
fi | |
echo $separator_bar; | |
echo "[*] Done!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment