Answers:
除非命令已配置输出或日志记录,否则rc.local命令将不会在任何地方记录日志。
如果你想查看特定命令日志,尝试重定向输出和错误的rc.local某处,您可以检查。尝试将其添加到/etc/rc.local文件顶部:
exec 1>/tmp/rc.local.log 2>&1  # send stdout and stderr from rc.local to a log file
set -x                         # tell sh to display commands before execution
虽然这将需要重新运行rc.local文件。
&>重定向是一种Bash主义,在Dash和其他/bin/sh解释器(例如用于的解释器)的“纯”实现中默默地失败了rc.local。
                    !/bin/sh -e吗?
                    尝试检查/var/log/syslog文件中的故障。
使用systemd时,rc.local被视为systemd收集日志的服务。您可以使用以下方法查看它们:
systemctl status rc.local.service
您可以通过服务日志查看错误(如果存在)。
exec &> /tmp/rc.local.log而不是两个exec调用就足够了:-)