forked from Percona-QA/package-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmadmin_check.sh
More file actions
executable file
·48 lines (40 loc) · 779 Bytes
/
madmin_check.sh
File metadata and controls
executable file
·48 lines (40 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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