[英]Debian Startup Script Will Not Start
當我收到類似於的錯誤時,我正在創建一個啟動BASH腳本:
The script is missing LSB tags
所以我去了一些LSB標簽,但它仍然沒有在啟動時啟動。 如果我手動啟動它,該腳本將完美運行
# /etc/init.d/myscript
這是一個非常簡單的腳本,用於在同一文件夾(/etc/init.d/fcgiwrap.pl)中啟動PERL腳本。
#!/bin/bash
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
# Carry out specific functions when asked to by the system
touch /var/lock/fcgiwrap
case "$1" in
start)
echo "Starting script /etc/init.d/fcgiwrap.pl"
/etc/init.d/fcgiwrap.pl
;;
stop)
echo "You can't stop this service. Consider deleting it"
;;
*)
echo "Usage: /etc/init.d/blah {start}"
exit 1
;;
esac
exit 0
為了讓腳本“在啟動時”執行操作,您需要為它運行命令( rc.d
)規則。 否則它只是一個漂浮在/etc/init.d
的腳本。
有關rc.d
的指南, 請訪問https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian ,並特別查看update-rc.d
命令。
此外,如果您要使用LSB樣式標題,您也可以實際填寫值以獲得含義,而不是保留這些默認值。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.