blob: 550d354335ab8f53476482715df5c84c1180d258 (
plain)
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
|
#!/bin/sh
# PROVIDE: riak-cs
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable riak-cs:
# riak-cs_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable riak-cs on boot.
#
. /etc/rc.subr
name=riak_cs
rcvar=riak_cs_enable
pidfile=/var/run/riak-cs/riak-cs.pid
start_cmd="riak_cs_start"
stop_cmd="riak_cs_stop"
restart_cdm="riak_cs_restart"
status_cmd="riak_cs_status"
command="%%PREFIX%%/sbin/riak-cs"
load_rc_config $name
# Read rc.d config and set defaults
load_rc_config "$name"
: ${riak_cs_enable="NO"}
riak_cs_start()
{
echo "Starting Riak."
%%PREFIX%%/sbin/riak-cs start
return 0
}
riak_cs_stop()
{
echo "Stopping Riak processes"
%%PREFIX%%/sbin/riak-cs stop
killall -9 epmd
return 0
}
riak_cs_restart()
{
riak_cs_stop
riak_cs_start
return 0
}
riak_cs_status()
{
if riak_cs_running; then
echo "Riak is running."
return 0
else
echo "Riak is not running"
return 1
fi
}
riak_cs_running()
{
local pid result ps
pid=`%%PREFIX%%/sbin/riak-cs getpid`
result=`echo $?`
if [ "$result" == 0 ]; then
ps=`ps -waux | grep ${pid} | grep riak-cs`
result=`echo $?`
if [ "$result" ]; then
return 0
else
return 1
fi
else
return 1
fi
}
run_rc_command "$1"
|