rc.local的日志內容默認是/var/log/boot.log
/etc/rc.d/rc.local文件的文件頭是#!/bin/sh ,我們把這修改成#!/bin/sh -x,這樣系統啟動后就會把/etc/rc.d/rc.local里面的指令或腳本不能執行的日志寫入/var/log/messages,或者/var/log/boot.log里,自己驗證
下面的配置會把rc.local里要執行的sh腳本的日志內容輸出到/tmp/rc.local.log里
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
https://www.h2mes.com/2017/08/16/%E5%85%B3%E4%BA%8ELinux%E5%90%AF%E5%8A%A8%E6%96%87%E4%BB%B6rc-local%E7%9A%84%E8%A7%A3%E6%83%91/
