add_conf_settings.sh.in 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/bash
  2. ################################################################################
  3. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. ################################################################################
  17. ###<REPLACE>###
  18. HPCC_CONFIG=${HPCC_CONFIG:-${CONFIG_DIR}/${ENV_CONF_FILE}}
  19. SECTION=${1:-DEFAULT}
  20. USER_NAME=`cat ${HPCC_CONFIG} | sed -n "/\[${SECTION}\]/,/\[/p" | grep "^user *= *" | sed -e 's/^user *= *//'`
  21. PREFIX_PATH=`cat ${HPCC_CONFIG} | sed -n "/\[${SECTION}\]/,/\[/p" | grep "^path *= *" | sed -e 's/^path *= *//'`
  22. source $PREFIX_PATH/sbin/alter_confs.sh
  23. alter_file /etc/sudoers "^Cmnd_Alias HPCC_|^${USER_NAME} ALL =|^Defaults\:${USER_NAME} !requiretty" <<-%EOF
  24. Cmnd_Alias HPCC_DAFILESRV = /etc/init.d/dafilesrv
  25. Cmnd_Alias HPCC_HPCCINIT = /etc/init.d/hpcc-init
  26. ${USER_NAME} ALL = NOPASSWD: HPCC_DAFILESRV, HPCC_HPCCINIT
  27. Defaults:${USER_NAME} !requiretty
  28. %EOF
  29. alter_file /etc/security/limits.conf "^${USER_NAME}" << %EOF
  30. ${USER_NAME} soft nofile 8192
  31. ${USER_NAME} hard nofile 32768
  32. ${USER_NAME} soft core unlimited
  33. ${USER_NAME} hard core unlimited
  34. ${USER_NAME} soft nproc 4096
  35. ${USER_NAME} hard nproc 8192
  36. ${USER_NAME} soft rtprio 0
  37. ${USER_NAME} hard rtprio 4
  38. ${USER_NAME} soft memlock unlimited
  39. ${USER_NAME} hard memlock unlimited
  40. %EOF