aerospike.init 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/sbin/openrc-run
  2. # Copyright 1999-2014 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. config_file=${config_file:-/etc/aerospike/${SVCNAME}.conf}
  5. run_dir=${run_dir:-/run/aerospike}
  6. command="/usr/bin/asd"
  7. command_args="--config-file ${config_file}"
  8. command_background="false"
  9. pidfile=${run_dir}/${SVCNAME}.pid
  10. user=${user:-aerospike}
  11. group=${group:-aerospike}
  12. start_stop_daemon_args="--user ${user} --group ${group}"
  13. required_files="${config_file}"
  14. depend() {
  15. use net
  16. }
  17. set_shmall() {
  18. mem=`/sbin/sysctl -n kernel.shmall`
  19. min=4294967296
  20. if [ ${#mem} -le ${#min} ]; then
  21. if [ $mem -lt $min ]; then
  22. ewarn "kernel.shmall too low, setting to 4G pages = 16TB"
  23. /sbin/sysctl -w kernel.shmall=$min
  24. fi
  25. fi
  26. }
  27. set_shmmax() {
  28. mem=`/sbin/sysctl -n kernel.shmmax`
  29. min=1073741824
  30. if [ ${#mem} -le ${#min} ]; then
  31. if [ $mem -lt $min ]; then
  32. ewarn "kernel.shmmax too low, setting to 1GB"
  33. /sbin/sysctl -w kernel.shmmax=$min
  34. fi
  35. fi
  36. }
  37. start_pre() {
  38. checkpath -d -m 0755 -o "${user}":"${group}" "${run_dir}"
  39. set_shmall
  40. set_shmmax
  41. ulimit -n 100000
  42. if [ -n $LD_PRELOAD ]; then export LD_PRELOAD; fi
  43. }
  44. start_post() {
  45. ewaitfile 60 "${pidfile}"
  46. }