sapconf/SOURCES/sapconf-use-systemct-instea...

142 lines
5.5 KiB
Diff

diff --git a/sapconf b/sapconf
index 369b6be..6cd6173 100644
--- a/sapconf
+++ b/sapconf
@@ -180,7 +180,7 @@ function rec_out() {
out ""
out "###### RECOMMENDATIONS ######"
out "## Below are recommended settings that can not ##"
-out "## Be carried out by the ${SCRIPTNAME} script ##"
+out "## Be carried out by the ${SCRIPTNAME} script ##"
out "## Please check and set them manually ##"
out "## ---------------------------------------------- ##"
for (( i=1; i<=$rec_count; i++))
@@ -276,7 +276,13 @@ SHMMAX_REQ=$(( $VIRT_MEMORY_TOTAL * 1024 * 1024 * 1024 ))
# The two kernel parameters required by Sybase ASE
RANDOMIZE_VA_SPACE=`/sbin/sysctl -n kernel.randomize_va_space`
-EXEC_SHIELD=`/sbin/sysctl -n kernel.exec-shield`
+EXEC_SHIELD=`/sbin/sysctl -en kernel.exec-shield`
+
+# Check if exec-shield is not set as it seems to be not used on 64bit systems, otherwise set it
+# to 0 to indicate that is already disabled
+if [ -z "$EXEC_SHIELD" ]; then
+ EXEC_SHIELD=0
+fi
ARCH=`uname -m`
case $ARCH in
@@ -498,7 +504,7 @@ else
fi
## modify /etc/hosts
-## at this point in time /etc/sysconfig network is ok.
+## at this point in time /etc/sysconfig/network is ok.
## so still need to check, if hosts is correct.
# Check what happens if $hs=localhost or if a different branch needs to be added, which
# finds the ip adress of the first network card
@@ -627,13 +633,12 @@ if [ $(getenforce | awk '{ print $1 } ') = enforcing ]; then
fi
# Firewall needs to be off
-if service iptables status > /dev/null 2>&1 ; then
+if systemctl status firewalld.service > /dev/null 2>&1 ; then
if [ $CHECK_ONLY == 0 ]; then
# disable firewall or open required ports
- service iptables save > /dev/null 2>&1
- chkconfig iptables off
- service iptables stop > /dev/null 2>&1
- out "Firewall has been disabled for SAP. iptables settings are saved in file /etc/sysconfig/iptables"
+ systemctl disable firewalld.service
+ systemctl stop firewalld.service > /dev/null 2>&1
+ out "Firewall has been disabled for SAP"
else
rec "Firewall is enabled. If you leave the firewall on please open up the ports for SAP products. Firewall will be disabled by ${SCRIPTNAME} in execution mode"
#out "Firewall state ... OK"
@@ -650,7 +655,9 @@ fi
function check_chronyd() {
-if service chronyd status 1>/dev/null 2>&1 ; then
+systemctl status chronyd.service > /dev/null 2>&1
+rc=$?
+if [ $rc -eq 0 ]; then
out "NTP service is running ... OK"
else
rec "NTP Service should be configured and started"
@@ -731,7 +738,7 @@ fi
function check_links() {
# set symbolic links for LDAP
-if [ -e /usr/lib64/libldap.so.199 -a -e /usr/lib64/liblber.so.199 ]; then
+if [ -L /usr/lib64/libldap.so.199 -a -L /usr/lib64/liblber.so.199 ]; then
out "SAP LDAP Links ... OK"
else
#out "SAP LDAP Links ... not OK"
@@ -748,7 +755,7 @@ else
fi
# old version backward compatibility
-if [ -e /usr/lib/libstdc++-libc6.1-1.so.3 ]; then
+if [ -L /usr/lib/libstdc++-libc6.1-1.so.3 ]; then
out "SAP old version compat links ... OK"
else
#out "SAP old version compat Links ... not OK"
@@ -771,20 +778,22 @@ fi
function check_uuidd() {
if [ $CHECK_ONLY == 0 ]; then
- if chkconfig uuidd; then
+ systemctl is-enabled uuidd.service > /dev/null 2>&1
+ rc=$?
+ if [ $rc -eq 0 ]; then
out "Service uuidd autostart ... OK"
else
# uuidd permissions
- chkconfig uuidd on
+ systemctl enable uuidd.service
out "Service uuidd set to autostart ... OK"
fi
- service uuidd status > /dev/null 2>&1
+ systemctl status uuidd.service > /dev/null 2>&1
rc=$?
if [ $rc -eq 0 ]; then
out "Service uuidd already running"
else
out "Service uuidd not running ... Starting"
- service uuidd start > /dev/null 2>&1
+ systemctl start uuidd.service > /dev/null 2>&1
fi
else
rpm -q uuidd > /dev/null 2>&1
@@ -792,13 +801,15 @@ else
if [ $rc -eq 1 ]; then
rec "Please make sure that package uuidd is installed, and service uuidd is started and set to autostart: yum install -y -q uuidd; service uuidd start; chkconfig uuidd on"
else
- if !(chkconfig uuidd); then
- rec "Please make sure that service uuidd is set to autostart: chkconfig uuidd on"
+ systemctl is-enabled uuidd.service > /dev/null 2>&1
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ rec "Please make sure that service uuidd is set to autostart: systemctl enable uuidd.service"
fi
- service uuidd status > /dev/null 2>&1
+ systemctl status uuidd.service > /dev/null 2>&1
rc=$?
if [ $rc -ne 0 ]; then
- rec "Please make sure that service uuidd is started: service uuidd start"
+ rec "Please make sure that service uuidd is started: systemctl start uuidd.service"
fi
fi
fi
@@ -842,7 +853,7 @@ if [ $1 ]; then
usage
fi
-out "###### ${SCRIPTNAME} by Red Hat ######"
+out "###### ${SCRIPTNAME} by Red Hat ######"
if [ $CHECK_ONLY == 0 ]; then
out "###### Preparing System for SAP Installation ######"
else