小编Pet*_*rdk的帖子

启动时 init.d 脚本的 PATH 问题

我有一个简单的脚本来启动一个独角兽实例(在 Ubuntu 12.04LTS 上)。

#!/bin/sh

case "$1" in
    start)
       echo "starting"
       cd /path && bundle exec unicorn -c /path/config/unicorn.rb -D -E production
      ;;
     stop)
      echo "Stopping Unicorn Instances"
      kill `cat /tmp/unicorn.pid`
    ;;
    restart)
    echo "sending USR2 to all unicorns"
    kill -s USR2 `cat /tmp/unicorn.pid`
    ;;
esac
exit 0
Run Code Online (Sandbox Code Playgroud)

调用时它的行为正确: /etc/init.d/unicorn_boot.sh start

我希望它在启动时启动,所以我跑了: update-rc.d -f unicorn_boot.sh defaults

当我现在重新启动时,出现以下错误:

/etc/rc2.d/S20unicorn_boot.sh: 10: /etc/rc2.d/S20unicorn_boot.sh: bundle: not found

我检查了bundle命令,它安装在 中/usr/local/bin,与ruby命令相同。

似乎在启动PATH时还没有包含/usr/local/bin. 我怎样才能解决这个问题?

ubuntu path init.d

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

init.d ×1

path ×1

ubuntu ×1