我正在使用 FreeBSD 9.2-RELEASE:
# uname -a
FreeBSD f9.alexus.org 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
#
每隔一段时间bsnmpd(1)
就会给我产生以下消息:
# bzip2 -cd /var/log/all.log.0.bz2 | grep bsnmpd
Oct 12 21:01:44 f9 kernel: pid 62584 (bsnmpd), uid 0: exited on signal 6 (core dumped)
#
我真的想弄清楚是什么原因造成的,但同时:
# crontab -l | grep @hourly
@hourly `which service` bsnmpd status >/dev/null ; if ( $? != 0 ) `which service` bsnmpd start ; endif
#
我不断收到包含以下消息的电子邮件:
Syntax error: word unexpected (expecting "then")
测试(通过shell):
# `which service` bsnmpd status >/dev/null ; if ( $? != 0 ) `which service` bsnmpd start ; endif
# /etc/rc.d/bsnmpd stop
Stopping bsnmpd.
Waiting for PIDS: 60671.
# /etc/rc.d/bsnmpd status
bsnmpd is not running.
# `which service` bsnmpd status > /dev/null ; if ( $? != 0 ) `which service` bsnmpd start ; endif
Starting bsnmpd.
# /etc/rc.d/bsnmpd status
bsnmpd is running as pid 61042.
#
- 我如何才能调试导致
bsnmpd(1)
退出的原因? - 我的 cronjob 出了什么问题?
答案1
您可能希望 cron 作业看起来更像这样:
/usr/sbin/service bsnmpd status >/dev/null ; if [ $? != 0 ] ; then /usr/sbin/service bsnmpd start ; fi
无论如何,让我们弄清楚为什么 bsnmpd 会进行核心转储。看看您是否可以找到该bsnmpd.core
文件,然后运行/usr/bin/gdb /usr/sbin/bsnmpd bsnmpd.core
并bt
粘贴输出。