AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-36792

massi's questions

Martin Hope
massi
Asked: 2010-03-05 15:09:55 +0800 CST

init.d 脚本不起作用....但是如果我在控制台中执行该命令,则该命令有效

  • 1

如果我从命令行执行它,我有一个可以正常工作的命令......但是当我将它放在 init.d 脚本中时它不会启动(嗯..它启动但行为与运行时不同直接地)。

知道为什么这不适用于 init 脚本吗?

命令是:bluepill load /var/www/html/bluepill.conf

init.d 脚本是:

    #!/bin/sh

    ## Based on http://www.novell.com/coolsolutions/feature/15380.html
    # chkconfig: 345 99 1
    # processname: solr
    # Provides: bluepill
    # Default-Start: 3 4 5
    # Default-Stop: 0 1 2 6
    # Short-Description: bluepill daemon, providing process monitoring
    # Description: Bluepill

    # Check for missing binaries
    BLUEPILL_BIN=/usr/local/bin/bluepill
    test -x $BLUEPILL_BIN || { echo "$BLUEPILL_BIN not installed";
            if [ "$1" = "stop" ]; then exit 0;
            else exit 5; fi; }

    # Check for existence of needed config file and read it
    BLUEPILL_CONFIG=/var/www/html/bluepill.conf
    test -r $BLUEPILL_CONFIG || { echo "$BLUEPILL_CONFIG not existing";
            if [ "$1" = "stop" ]; then exit 0;
            else exit 6; fi; }

    case "$1" in
      start)
        echo -n "Starting bluepill "
        $BLUEPILL_BIN load $BLUEPILL_CONFIG
        ;;
      stop)
        echo -n "Shutting down bluepill "
        $BLUEPILL_BIN quit
        ;;
      restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start
      ;;
      *)
        ## If no parameters are given, print which are avaiable.
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
    esac

更新(回答几个问题):

我还添加了脚本,以便在启动时使用:

chkconfig --add bluepill_script  
chkconfig --level 345 bluepill_script  on  
linux centos scripting inittab
  • 7 个回答
  • 32564 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve