summaryrefslogtreecommitdiff
blob: 59caf81cf9144982f8f8093deae32b92b7d7d9fd (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
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

config_file=${config_file:-/etc/scylla/scylla.yaml}
run_dir=${run_dir:-/run/scylla}
chdir=${chdir:-/var/lib/scylla/coredump}

command="/usr/bin/scylla"
command_args="--options-file ${config_file} ${CPUSET} ${DEV_MODE} ${SEASTAR_IO} ${SCYLLA_ARGS}"
command_background="true"
command_progress="true"
pidfile=${run_dir}/${SVCNAME}.pid
user=${USER:-scylla}
group=${GROUP:-scylla}
retry="SIGTERM/120"
start_stop_daemon_args="--chdir ${chdir} --user ${user} --group ${group} --wait 5000"

depend() {
	use net localmount logger
}

start_pre() {
	checkpath -d -m 0750 -o "${user}":"${group}" "${run_dir}"
	if [ ! -f ${config_file} ]; then
		eerror "Missing configuration file ${config_file}"
		return 1
	fi
	export SCYLLA_CONF SCYLLA_HOME
	ebegin "Running scylla_prepare"
	/usr/lib/scylla/scylla_prepare >/dev/null
}

stop_pre() {
	ebegin "Draining node"
	$(which nodetool) drain || ewarn "Draining failed!"
}

stop_post() {
	ebegin "Running scylla_stop"
	/usr/lib/scylla/scylla_stop >/dev/null
}