rsync同步要開機就啟動服務,vi了 /etc/rc.local后重啟發現不生效,找了下博客發現這位仁兄說的很清楚。
粘過來記錄下。
博客地址:
https://www.cnblogs.com/link01/p/12165245.html
執行ll /etc/rc.local命令,發現/etc/rc.local映射文件是/etc/rc.d/rc.local 再ll /etc/rc.d/rc.local發現這個文件沒有執行權限(少了x); 其實vi /etc/rc.local有這樣一段話 # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. 所以執行chmod +x /etc/rc.d/rc.local命令后,啟動可以執行這個文件了。 但是還有一個問題,需要保證rc.local文件里面執行的腳本都是可執行的,否則依然無效。 另外如果在rc.local添加多條重復的啟動命令腳本,也是無效的。