【问题标题】:Symlinking unicorn_init.sh into /etc/init.d doesn't show with chkconfig --list将 unicorn_init.sh 符号链接到 /etc/init.d 不显示 chkconfig --list
【发布时间】:2015-06-08 16:20:33
【问题描述】:

我将我的 config/unicorn_init.sh 符号链接到 /etc/init.d/unicorn_project 与:

sudo ln -nfs config/unicorn_init.sh /etc/init.d/unicorn_<project>

之后,当我运行 chkconfig --list 时,我的 unicorn_ 脚本没有显示。我正在添加我的独角兽脚本以在服务器负载时加载我的应用程序。

显然,这不允许我添加我的脚本:

chkconfig unicorn_<project> on

任何帮助/建议都会很棒:)。

编辑:

另外,当我在 /etc/init.d/ 中运行时:

sudo service unicorn_project start

上面写着:“无法识别的服务”

【问题讨论】:

    标签: sinatra server unicorn centos6


    【解决方案1】:

    我想通了。我所做的事情有两点错误:

    1) 您必须通过在#!/bin/bash 下方添加以下代码来确保您的 unicorn 脚本可以与 chkconfig 配合使用。向digitalocean's blog 寻求帮助。

    # chkconfig:   2345 95 20
    # description: Controls Unicorn sinatra server
    # processname: unicorn
    

    2) 当我已经在项目目录中时,我试图对 config/unicorn_init.sh 文件进行符号链接,该目录正在使用相对路径创建悬空符号链接(粉红色符号链接 ~> 应该是青色)。为了解决这个问题,我删除了悬空符号链接并提供了 unicorn_init.sh 文件的绝对路径。

    为了调试它,我在 /etc/init.d/ 目录中使用 ll 来查看 r、w、x 权限和文件类型,正在运行 chkconfig --list 以查看 /etc/init 中的服务列表。 d/ 并且还试图在我的 /etc/init.d 目录中使用 sudo service unicorn_&lt;project&gt; restart 运行悬空符号链接

    希望这对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 2017-09-12
      • 2014-02-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多