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