我正在使用Raspberry Pi 3
。有时,名为ntp
的进程实际上是/etc/cron.daily/ntp
,导致 100%cpu使用数小时和数天,直到我通过命令停止进程。似乎它一直停滞不前。
top
看起来像这样:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
25706 root 20 0 3852 1028 856 R 97.8 0.1 3580:45 ntp
/etc/cron.daily/ntp
文件本身看起来像这样。我认为它可能是RaspberryPi添加到系统中的,所以我也发布了这段代码。
#!/bin/sh
# The default Debian ntp.conf enables logging of various statistics to
# the /var/log/ntpstats directory. The daemon automatically changes
# to a new datestamped set of files at midnight, so all we need to do
# is delete old ones, and compress the ones we're keeping so disk
# usage is controlled.
statsdir=$(cat /etc/ntp.conf | grep -v '^#' | sed -n 's/statsdir \([^ ][^ ]*\)/\1/p')
if [ -n "$statsdir" ] && [ -d "$statsdir" ]; then
# only keep a week's depth of these
find "$statsdir" -type f -mtime +7 -exec rm {} \;
# compress whatever is left to save space
cd "$statsdir"
ls *stats.???????? > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Note that gzip won't compress the file names that
# are hard links to the live/current files, so this
# compresses yesterday and previous, leaving the live
# log alone. We supress the warnings gzip issues
# about not compressing the linked file.
gzip --best --quiet *stats.????????
return=$?
case $return in
2)
exit 0 # squash all warnings
;;
*)
exit $return # but let real errors through
;;
esac
fi
fi
问题出在哪里?任何帮助将不胜感激!