1
Linux 討論版 / 請教CentOS 7 的 rc.local 啟動的問題
« 於: 2016-06-12 21:00 »
請教一下,因為以前都會用 rc.local 來設定開機自動執行一些程式,
在 CentOS 7 改用 systemd 系統來管理開機程序,雖然 rc.local 仍然可以使用,
但是文件有一些註解: 因為 systemd 是平行啟動程式,所以不會保證 rc.local 會等所有的 service 都啟動完成才執行,
請問,如果,我想確定等所有的 service 都啟動完成了,再執行 rc.local 這個要如何設定
以下是 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.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
這說明不保證 rc.local 會等所有的 service 都啟動了,才執行
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
在 CentOS 7 改用 systemd 系統來管理開機程序,雖然 rc.local 仍然可以使用,
但是文件有一些註解: 因為 systemd 是平行啟動程式,所以不會保證 rc.local 會等所有的 service 都啟動完成才執行,
請問,如果,我想確定等所有的 service 都啟動完成了,再執行 rc.local 這個要如何設定
以下是 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.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
這說明不保證 rc.local 會等所有的 service 都啟動了,才執行
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.