You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start(){
Memory_usage before starting;
sudo systemctl start $1 ;
echo -n " Service is: ";
sudo systemctl status $1 | grep Active | awk '{print $2}';
Memory_usage after starting;
}
Stop(){
Memory_usage before stopping;
sudo systemctl stop $1;
echo -n " Service is: ";
sudo systemctl status $1 | grep Active | awk '{print $2}';
Memory_usage after stopping;
}
Status(){
echo -n " Service is: ";
sudo systemctl status $1 | grep Active | awk '{print $2}';
}
#Main program
Search_Postgre_Service
echo -e "\e[1;32mBienvenue dan l'utilitaire PostgreSQL du script!\e[0m\n"
echo -e "\e[1;32mTu navigues sur la version $SERVICE_NAME\e[0m\n"
Search_Postgre_Service
case $1 in
"start") Start $SERVICE_NAME;;
"stop") Stop $SERVICE_NAME;;
"status") Status $SERVICE_NAME;;
"help") echo -e "Script usage:\n PostgreSQL.sh start to start the service \n PostgreSQL.sh stop to stop the service";;
*) echo "Command not found!"
esac
The text was updated successfully, but these errors were encountered:
#!/bin/bash
#Functions definition
Search_Postgre_Service(){
SERVICE_NAME=$(systemctl list-unit-files |grep postgresql|awk -F '.' '{print $1}')
}
Memory_usage(){
echo -n " Memory used $1 $2 the service: "
MEM=$(free |grep Mem |awk '{print $3}';)
SWAP=$(free |grep Swap |awk '{print $3}';)
Tot_Mem=$(($MEM + $SWAP))
echo -e "\e[1;31m$Tot_Mem\e[0m"
}
Start(){
Memory_usage before starting;
sudo systemctl start $1 ;
echo -n " Service is: ";
sudo systemctl status $1 | grep Active | awk '{print $2}';
Memory_usage after starting;
}
Stop(){
Memory_usage before stopping;
sudo systemctl stop $1;
echo -n " Service is: ";
sudo systemctl status $1 | grep Active | awk '{print $2}';
Memory_usage after stopping;
}
Status(){
echo -n " Service is: ";
sudo systemctl status $1 | grep Active | awk '{print $2}';
}
#Main program
Search_Postgre_Service
echo -e "\e[1;32mBienvenue dan l'utilitaire PostgreSQL du script!\e[0m\n"
echo -e "\e[1;32mTu navigues sur la version $SERVICE_NAME\e[0m\n"
Search_Postgre_Service
case $1 in
"start") Start $SERVICE_NAME;;
"stop") Stop $SERVICE_NAME;;
"status") Status $SERVICE_NAME;;
"help") echo -e "Script usage:\n PostgreSQL.sh start to start the service \n PostgreSQL.sh stop to stop the service";;
*) echo "Command not found!"
esac
The text was updated successfully, but these errors were encountered: