CRON 问题 - apt-get dist-upgrade 作业

CRON 问题 - apt-get dist-upgrade 作业

这个问题与 Debian 8.4 有关。

我对几个桌面站和一台未使用的服务器应用了相同的更新机制。这个问题出现在服务器上,但我怀疑它也会发生在所有这些站上。

正如这个线程中解决的那样,我设法记录了 cron 作业,现在我等待更新。它来了,所以有一条错误信息,这对我来说完全是胡言乱语。

请先看看我这里是如何设置的: 我如何知道 crontab 是否工作正常?

当想要下载档案时,日志的相关部分就会启动。

Apr  8 00:00:42 vb-srv-debian updates: Need to get 108 MB of archives.
Apr  8 00:00:42 vb-srv-debian updates: After this operation, 20.5 kB of additional disk space will be used.
Apr  8 00:00:42 vb-srv-debian updates: Get:1 http://dl.google.com/linux/chrome/deb/ stable/main google-chrome-stable amd64 49.0.2623.112-1 [48.5 MB]
Apr  8 00:00:42 vb-srv-debian updates: Get:2 http://nightly.odoo.com/9.0/nightly/deb/ ./ odoo 9.0c.20160407 [59.6 MB]
Apr  8 00:00:54 vb-srv-debian updates: Reading changelogs...
Apr  8 00:01:01 vb-srv-debian updates: debconf: unable to initialize frontend: Dialog
Apr  8 00:01:01 vb-srv-debian updates: debconf: (TERM is not set, so the dialog frontend is not usable.)
Apr  8 00:01:01 vb-srv-debian updates: debconf: falling back to frontend: Readline
Apr  8 00:01:01 vb-srv-debian updates: debconf: unable to initialize frontend: Readline
Apr  8 00:01:01 vb-srv-debian updates: debconf: (This frontend requires a controlling tty.)
Apr  8 00:01:01 vb-srv-debian updates: debconf: falling back to frontend: Teletype
Apr  8 00:01:01 vb-srv-debian updates: dpkg-preconfigure: unable to re-open stdin:
Apr  8 00:01:01 vb-srv-debian updates: Fetched 108 MB in 11s (9,111 kB/s)
Apr  8 00:01:01 vb-srv-debian updates: dpkg: warning: 'ldconfig' not found in PATH or not executable
Apr  8 00:01:01 vb-srv-debian updates: dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
Apr  8 00:01:01 vb-srv-debian updates: dpkg: error: 2 expected programs not found in PATH or not executable
Apr  8 00:01:01 vb-srv-debian updates: Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
Apr  8 00:01:01 vb-srv-debian updates: E: Sub-process /usr/bin/dpkg returned an error code (2)

我怀疑主要的,如果不是只有一个问题与变量有关$PATH,我目前不明白它是如何使用的。

当 为 时root,将返回以下变量值:

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

$ echo $TERM
xterm

答案1

cron通常在一个相当小的环境中运行东西(man 5 crontab看看到底是什么),它的路径中可能没有足够的资源来实现这一点。如果你想看什么在路上,你可以随时跑printenv > /tmp/cron_env过来(大概是在不久的将来的某个时候)去看。一般来说,您可以PATH在 crontab 文件中定义更新;再次查看man 5 crontab详情。

相关内容