This repository has been archived by the owner on Dec 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_cbq-engine
87 lines (77 loc) · 1.44 KB
/
init_cbq-engine
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
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
#
# description: Start up Couchbase Query Engine as daemon service
# usage: CentOS based init script used for N1ql dp4
# chkconfig: 2345 99 99
# processname: cbq-engine
#
# source function library
. /etc/rc.d/init.d/functions
# Vars
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
NAME=cbq-engine
PROG=/opt/cbq-dp4/${NAME}
LOGFILE=/var/log/${NAME}
LOCKFILE=/var/lock/subsys/${NAME}
PIDFILE=/var/run/${NAME}.pid
ARGS="-datastore http://127.0.0.1:8091 >> ${LOGFILE} 2>&1"
RETVAL=0
# Functions
start() {
if [ ! -x ${PROG} ]
then
echo "${PROG} is missing"
exit 5
fi
[ ${UID} -ne 0 ] && exit 4
echo -n "Starting ${NAME}: "
if [ -f ${LOCKFILE} ]
then
echo "Lock file already exists ... Exiting !"
exit 1
else
daemon --pidfile ${PIDFILE} "nohup ${PROG} ${ARGS} &"
RETVAL=${?}
[ ${RETVAL} -eq 0 ] && touch ${LOCKFILE} && success || failure
echo $(pidof ${NAME}) > ${PIDFILE}
echo
return ${RETVAL}
fi
}
stop() {
[ ${UID} -ne 0 ] && exit 4
echo -n "Stopping ${NAME}: "
killproc -p ${PIDFILE} && success || failure
RETVAL=${?}
[ ${RETVAL} -eq 0 ] && rm -f ${LOCKFILE}
echo
return ${RETVAL}
}
restart() {
stop
start
}
rh_status() {
status ${NAME}
RETVAL=${?}
return ${RETVAL}
}
case "${1}" in
start)
start
;;
stop)
stop
;;
status)
rh_status
;;
restart)
restart
;;
*)
echo "Usage: ${0} {start|stop|restart|status}"
exit 1
esac
exit ${RETVAL}
# EOS