mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
RH8 genesis scripts
This commit is contained in:
parent
f25ee7e2cb
commit
a80c172f83
@ -8,12 +8,15 @@ log_label="xcat.genesis.doxcat"
|
||||
# Start rsyslogd and log into a local file specified in /etc/rsyslog.conf
|
||||
# Later, once xCAT MN is known, dhclient-script will change
|
||||
# rsyslog.conf file to send log entries to xCAT MN
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1`
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | grep -m1 "rsyslogd" | tr -s ' ' | cut -d" " -f2 | cut -d"." -f1`
|
||||
|
||||
# if syslog is running and there's a pid file, kill it before restarting syslogd
|
||||
if [ -f /var/run/syslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/syslogd.pid`
|
||||
fi
|
||||
if [ -f /var/run/rsyslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/rsyslogd.pid`
|
||||
fi
|
||||
|
||||
if [ $RSYSLOGD_VERSION -ge 8 ]; then
|
||||
/sbin/rsyslogd
|
||||
@ -66,6 +69,10 @@ fi
|
||||
rpcbind
|
||||
rpc.statd
|
||||
|
||||
# Generate some entropy, needed for ssh-keygen to unblock getrandom()
|
||||
if [ -e /usr/sbin/rngd ]; then
|
||||
/usr/sbin/rngd
|
||||
fi
|
||||
# Try -A available on more current version of ssh-keygen to generate all keys
|
||||
ssh-keygen -A 2> /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
@ -263,17 +270,21 @@ logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic"
|
||||
|
||||
ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|awk '{print $4}'
|
||||
|
||||
logger -s -t $log_label -p local4.info "Starting ntpd..."
|
||||
ntpd -g -x
|
||||
if [ -e /usr/sbin/ntpd ]; then
|
||||
logger -s -t $log_label -p local4.info "Starting ntpd..."
|
||||
ntpd -g -x
|
||||
|
||||
# ntp-wait defaults to 6 seconds between retries, wait for 1 minute
|
||||
NTP_TRIES=10
|
||||
NTP_SLEEP=6
|
||||
logger -s -t $log_label -p local4.info "Waiting for $NTP_TRIES x $NTP_SLEEP seconds for ntpd to synchronize..."
|
||||
ntp-wait -n $NTP_TRIES -s $NTP_SLEEP -v
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
logger -s -t $log_label -p local4.info "... ntpd did not synchronize."
|
||||
# ntp-wait defaults to 6 seconds between retries, wait for 1 minute
|
||||
NTP_TRIES=10
|
||||
NTP_SLEEP=6
|
||||
logger -s -t $log_label -p local4.info "Waiting for $NTP_TRIES x $NTP_SLEEP seconds for ntpd to synchronize..."
|
||||
ntp-wait -n $NTP_TRIES -s $NTP_SLEEP -v
|
||||
if [ $? -ne 0 ]; then
|
||||
logger -s -t $log_label -p local4.info "... ntpd did not synchronize."
|
||||
fi
|
||||
else
|
||||
logger -s -t $log_label -p local4.info "Starting chronyd..."
|
||||
chronyd -s
|
||||
fi
|
||||
|
||||
if [ -e "/dev/rtc" ]; then
|
||||
@ -283,15 +294,13 @@ if [ -e "/dev/rtc" ]; then
|
||||
fi
|
||||
|
||||
logger -s -t $log_label -p local4.info "Restarting syslog..."
|
||||
read -r RSYSLOG_PID </var/run/syslogd.pid 2>/dev/null
|
||||
kill "$RSYSLOG_PID" 2>/dev/null
|
||||
while kill -0 "$RSYSLOG_PID" 2>/dev/null
|
||||
do
|
||||
sleep 0.5
|
||||
done
|
||||
unset RSYSLOG_PID
|
||||
if [ -f /var/run/syslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/syslogd.pid`
|
||||
fi
|
||||
if [ -f /var/run/rsyslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/rsyslogd.pid`
|
||||
fi
|
||||
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | awk '/rsyslogd/ { split($2, a, "."); print a[1]; }'`
|
||||
if [ "$RSYSLOGD_VERSION" -ge 8 ]; then
|
||||
/sbin/rsyslogd
|
||||
else
|
||||
|
@ -44,9 +44,15 @@ while [ $WAITING -gt 0 ]; do
|
||||
done
|
||||
|
||||
# restart rsyslog after dhclient
|
||||
kill -9 `cat /var/run/syslogd.pid`
|
||||
if [ -f /var/run/syslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/syslogd.pid`
|
||||
fi
|
||||
if [ -f /var/run/rsyslogd.pid ]; then
|
||||
kill -TERM `cat /var/run/rsyslogd.pid`
|
||||
fi
|
||||
sleep 3
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1`
|
||||
|
||||
RSYSLOGD_VERSION=`rsyslogd -v | grep -m1 "rsyslogd" | tr -s ' ' | cut -d" " -f2 | cut -d"." -f1`
|
||||
if [ $RSYSLOGD_VERSION -ge 8 ]; then
|
||||
# Newer versions of rsyslogd do not support -c flag anymore
|
||||
/sbin/rsyslogd
|
||||
|
Loading…
x
Reference in New Issue
Block a user