简体   繁体   English

Unicorn init脚本 - 不在启动时启动

[英]Unicorn init script - not starting at boot

I'm very new to system administration and have no idea how init.d works. 我是系统管理的新手,不知道init.d是如何工作的。 So maybe I'm doing something wrong here. 也许我在这里做错了。

I'm trying to start unicorn on boot, but somehow it just fails to start everytime. 我正试图在启动时启动独角兽,但不知怎的,它每次都无法启动。 I'm able to manually do a start/stop/restart by simply service app_name start. 我可以通过简单的服务app_name start手动执行启动/停止/重启。 Can't seem to understand why unicorn doesn't start at boot if manual starting stopping of service works. 似乎无法理解为什么如果手动启动停止服务工作,独角兽不会在启动时启动。 Some user permission issue maybe ?? 一些用户权限问题可能??

My unicorn init script and the unicorn config files are available here https://gist.github.com/1956543 我的unicorn init脚本和独角兽配置文件​​可以在这里获得https://gist.github.com/1956543

I'm setting up a development environment on Ubuntu 11.1 running inside a VM. 我正在VM中运行的Ubuntu 11.1上设置开发环境。

UPDATE - Could it be possible because of the VM ? 更新 - 因为VM可能吗? I'm currently sharing the entire codebase (folder) with the VM, which also happens to contain the unicorn config needed to start unicorn. 我目前正在与VM共享整个代码库(文件夹),这也恰好包含启动独角兽所需的独角兽配置。

Any help would be greatly appreciated ! 任何帮助将不胜感激 !

Thanks 谢谢

To get Unicorn to run when your system boots, you need to associate the init.d script with the default set of "runlevels", which are the modes that Ubuntu enters as it boots. 要让Unicorn在系统引导时运行,您需要将init.d脚本与默认的“运行级别”集相关联,这是Ubuntu引导时进入的模式。

There are several different runlevels, but you probably just want the default set. 有几种不同的运行级别,但您可能只需要默认设置。 To install Unicorn here, run: 要在此处安装Unicorn,请运行:

sudo update-rc.d <your service name> defaults

For more information, check out the update-rc.d man page . 有关更多信息,请查看update-rc.d手册页

You can configure a cron job to start the unicorn server on reboot 您可以配置cron作业以在重新启动时启动unicorn服务器

crontab -e

and add 并添加

@reboot /bin/bash -l -c 'service unicorn_<your service name> start >> /<path to log file>/cron.log 2>&1'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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