代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/ntp 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
#
# ntp.sh: dhclient-script plugin for NTP settings,
# place in /etc/dhcp/dhclient.d and 'chmod +x ntp.sh' to enable
#
# Copyright (C) 2008 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Author(s): David Cantrell <dcantrell@redhat.com>
# Miroslav Lichvar <mlichvar@redhat.com>
#
CONF=/etc/ntp.conf
SAVECONF=${SAVEDIR}/${CONF##*/}.predhclient.${interface}
ntp_replace_conf() {
echo "$1" | diff -q ${CONF} - > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "$1" > ${CONF}
restorecon ${CONF} >/dev/null 2>&1
systemctl try-restart ntpd.service > /dev/null 2>&1 ||
service ntpd condrestart > /dev/null 2>&1
fi
}
ntp_config() {
if [ ! "${PEERNTP}" = "no" ] && [ -n "${new_ntp_servers}" ] &&
[ -e ${CONF} ] && [ -d ${SAVEDIR} ]; then
local conf=$(grep -v '^server .* # added by /sbin/dhclient-script$' < ${CONF})
local unique_servers=$(comm -23 \
<(for s in ${new_ntp_servers}; do echo $s; done | sort -u) \
<(echo "$conf" | awk '$1=="peer"||$1=="server"{print $2}' | sort -u))
conf=$(echo "$conf"
for s in ${unique_servers}; do
echo "server ${s} ${NTPSERVERARGS} # added by /sbin/dhclient-script"
done)
[ -f ${SAVECONF} ] || touch ${SAVECONF}
ntp_replace_conf "$conf"
fi
}
ntp_restore() {
if [ -e ${CONF} ] && [ -f ${SAVECONF} ]; then
local conf=$(grep -v '^server .* # added by /sbin/dhclient-script$' < ${CONF})
ntp_replace_conf "$conf"
rm -f ${SAVECONF}
fi
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。