forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aerospike.init
53 lines (46 loc) · 1.17 KB
/
aerospike.init
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
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
config_file=${config_file:-/etc/aerospike/${SVCNAME}.conf}
run_dir=${run_dir:-/run/aerospike}
command="/usr/bin/asd"
command_args="--config-file ${config_file}"
command_background="false"
pidfile=${run_dir}/${SVCNAME}.pid
user=${user:-aerospike}
group=${group:-aerospike}
start_stop_daemon_args="--user ${user} --group ${group}"
required_files="${config_file}"
depend() {
use net
}
set_shmall() {
mem=`/sbin/sysctl -n kernel.shmall`
min=4294967296
if [ ${#mem} -le ${#min} ]; then
if [ $mem -lt $min ]; then
ewarn "kernel.shmall too low, setting to 4G pages = 16TB"
/sbin/sysctl -w kernel.shmall=$min
fi
fi
}
set_shmmax() {
mem=`/sbin/sysctl -n kernel.shmmax`
min=1073741824
if [ ${#mem} -le ${#min} ]; then
if [ $mem -lt $min ]; then
ewarn "kernel.shmmax too low, setting to 1GB"
/sbin/sysctl -w kernel.shmmax=$min
fi
fi
}
start_pre() {
checkpath -d -m 0755 -o "${user}":"${group}" "${run_dir}"
set_shmall
set_shmmax
ulimit -n 100000
if [ -n $LD_PRELOAD ]; then export LD_PRELOAD; fi
}
start_post() {
ewaitfile 60 "${pidfile}"
}