-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmysql-service.sh
34 lines (30 loc) · 982 Bytes
/
mysql-service.sh
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
#!/usr/bin/sh
#
. /lib/svc/share/smf_include.sh
DB_DIR=/data/set/mydb1/mydata
PIDFILE=${DB_DIR}/`/usr/bin/uname -n`.pid
case "$1" in
start)
/opt/mysql5/bin/mysqld_safe --defaults-file=/data/set/mydb1/mydata/my.cnf --user=mysql --datadir=${DB_DIR} --pid-file=${PIDFILE} --log-error=/intmirror/set/mydb1/mylog/mysqldb1.err > /dev/null &
;;
stop)
if [ -f ${PIDFILE} ]; then
/usr/bin/pkill mysqld_safe >/dev/null 2>&1
/usr/bin/kill `cat ${PIDFILE}` > /dev/null 2>&1 && echo -n ' mysqld'
fi
;;
restart)
stop
while pgrep mysqld > /dev/null
do
sleep 1
done
start
;;
*)
echo ""
echo "Usage: `basename $0` { start | stop | restart }"
echo ""
exit -1
;;
esac