應項目要求須要在開機的時候啓動本身的Agent程序,想固然的直接就往/etc/rc.local
當中添加啓動命令,結果重啓以後發現什麼都沒有發生....一開始還覺得是Python路徑的問題,結果改爲絕對路徑以後仍是同樣,一番搜索以後發現原來是權限問題,執行chmod a+x /etc/rc.d/rc.local
解決問題。bash
其實/etc/rc.local
的說明當中已經說的很清楚了, /etc/rc.local
只是爲了兼容而設置的,若要執行須要爲/etc/rc.d/rc.local
添加執行權限,看來仍是不能慌呀,項目再忙也不能亂了手腳,原本這種稍微看下文檔說明就解決了的問題,結果仍是瞎折騰了一下,磨刀不誤砍柴工,古人誠不欺我。this
/etc/rc.local
實爲/etc/rc.d/rc.local
的軟鏈接[root@10-10-50-109 ~]# ls -l /etc/rc.local lrwxrwxrwx 1 root root 13 May 26 09:38 /etc/rc.local -> rc.d/rc.local
/etc/rc.d/rc.local
默認權限爲不可執行[root@10-10-50-109 ~]# ls -l /etc/rc.d/rc.local -rw-r--r-- 1 root root 473 Apr 13 03:57 /etc/rc.d/rc.local [root@10-10-50-109 ~]#
/etc/rc.local
當中的說明[root@10-10-50-109 ~]# cat /etc/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local [root@10-10-50-109 ~]#