-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrc.replicatord
76 lines (63 loc) · 1.46 KB
/
rc.replicatord
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/bash
# chkconfig: - 99 99
# description: replicatord daemon control script
# processname: replicatord
# pidfile: /var/run/replicatord.pid
. /etc/init.d/functions
ulimit -c unlimited
#### need to change ####
PROG="replicatord"
export BINFILE="/usr/local/sbin/$PROG"
export INSTANCE=""
export OPTIONS=""
########################
BASENAME=`basename $BINFILE`
if [ -n "$INSTANCE" ]; then
SUFIX=".$INSTANCE"
fi
export PIDFILE=/var/run/$BASENAME$SUFIX-wrapper.pid
export CHILDPIDFILE=/var/run/$BASENAME$SUFIX.pid
RETVAL=0
start() {
echo -n $"Starting $BASENAME$SUFIX: "
ulimit -n 65536
/usr/local/bin/mailru-wrapper.sh $BINFILE $INSTANCE $OPTIONS >/dev/null 2>/dev/null </dev/null &
echo_success
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $BASENAME$SUFIX: "
[ -f $CHILDPIDFILE ] && childpid=$(cat $CHILDPIDFILE)
killproc -p $PIDFILE -d 1000 /usr/local/bin/mailru-wrapper.sh && echo_success || echo_failure
if [ -n "$childpid" ]; then
while checkpid $childpid; do
sleep 1
done
fi
echo
return $RETVAL
}
restart(){
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status -p "$PIDFILE" $PROG
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL