forked from signal18/replication-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplication-manager-pro.init.deb7
executable file
·76 lines (64 loc) · 1.43 KB
/
replication-manager-pro.init.deb7
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
### BEGIN INIT INFO
# Provides: replication-manager
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts replication-manager
# Description: starts the MariaDB/MySQL replication-manager service
### END INIT INFO
# chkconfig: 2345 95 20
# description: Replication Manager is a MariaDB HA replication monitor
# Copyright (C) 2016 Stephane Varoqui @MariaDB
# All rights reserved.
# processname: replication-manager
#
# Use and distribution licensed under the LGPL license. See
# the COPYING file in this directory for full text.
MRMDATADIR="/usr/share/replication-manager"
MRMBASEDIR="/usr/bin"
export MRMBASEDIR=$MRMBASEDIR
export MRMDATADIR=$MRMDATADIR
export MRMUSER=mrm
export MRMGROUP=mrm
groupadd -f $MRMGROUP
useradd -g $MRMGROUP $MRMUSER > /dev/null 2>&1
chown -R $MRMUSER:$MRMGROUP $MRMDATADIR
CMD=$MRMBASEDIR/replication-manager-pro
PIDFILE=$MRMDATADIR/mrm.pid
. /lib/lsb/init-functions
start()
{
if [ -f $PIDFILE ]
then
if ps -p `cat $PIDFILE` > /dev/null
then
echo "$PID is running"
exit
fi
fi
su $MRMUSER <<EOF
nohup $CMD monitor < /dev/null > $MRMDATADIR/out.log 2>&1 &
pidof -s replication-manager-pro > $PIDFILE
EOF
}
stop()
{
kill `cat $PIDFILE`
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: $0 {start|stop|restart} "
;;
esac