Skip to content

Commit

Permalink
Added script which if mysqladmin shutdown is working correctly
Browse files Browse the repository at this point in the history
See BLD-907 and BLD-906 for reference
  • Loading branch information
hrvojem committed Dec 8, 2017
1 parent ec05d0f commit c666130
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions madmin_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
set -e

#check if service is running
function is_running {
if [ $(ps auxww| grep -v grep | grep -c "mysql") -gt 0 ]; then
# "service is running"
echo 1
else
# service is NOT running
echo 0
fi
}

run=$(is_running)
echo $run

if [ $run -eq 1 ]; then
echo "running mysqladmin shutdown"
mysqladmin shutdown
sleep 5
else
echo "Make sure that service is running before stopping it"
exit 1
fi

run=$(is_running)
echo $run

if [ $run -eq 0 ]; then
echo "service has been stopped successfully"
else
echo "service is still running"
exit 1
fi

echo "starting mysql service"
service mysql start

run=$(is_running)
echo $run

if [ $run -eq 1 ]; then
echo "service been started successfully"
else
echo "service didn't start"
exit 1
fi

0 comments on commit c666130

Please sign in to comment.