#!bin/sh呼叫程序在CentOS Bad Command Startup中



在debian中效果很好:

#!/bin/sh
time /usr/libexec/postfix/smtp $@

在centos中获得邮件日志中的错误:

warning: process /usr/libexec/postfix/smtp_time pid 28456 exit status 1
warning: /usr/libexec/postfix/smtp_time: bad command startup -- throttling

debuggin错误 exec 2>>/tmp/smtp.log; set -x; time /usr/libexec/postfix/smtp "$@"

+ time /usr/libexec/postfix/smtp -n smtptime -t unix -u -c
which: no /usr/libexec/postfix/smtp in ((null))
ERROR: /usr/libexec/postfix/smtp cannot be found.

但是文件存在并具有R X权利。

从您的set -x日志记录中,您的/bin/sh使用的time的实现试图找到使用which运行的文件,而无需查看该文件是否已经指定为完全 - 合格的路径。因此,考虑:

#!/bin/sh
export PATH=/usr/libexec/postfix:/bin:/usr/bin
time smtp "$@"

最新更新