繁体   English   中英

Debian启动脚本无法启动

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM