LoginSignup
8
9

More than 5 years have passed since last update.

unicorn用upstart script(redmine,ubuntu)

Last updated at Posted at 2014-08-26

Ubuntu14.04にRedmine&Unicornをセットアップし、Nginxとの連携も確認して、さて起動のスクリプトの準備と思ったところでハタと気がつきました。

Upstartじゃん!

ということでUpstart用のスクリプトを書きました。

で、調べて見ると意外なほどに情報がない。とりあえず見つけたUpstart を使ってお手軽 daemon 化経由でたどりついたUpstart Intro, Cookbook and Best Practises
を参照しました。

/etc/init/redmine.conf
#/etc/init/redmine.conf
description "Redmine"
author "Hiroshi Obata <obata.hiroshi@propos.jp>"


start on runlevel [2345]
stop on runlevel [016]


env PATH=/bin:/usr/bin:/sbin:/usr/sbin:/home/hiro/.rbenv/bin:/home/hiro/.rbenv/shims

env ENVIROMENT=production
env CONF=/var/redmine/config/unicorn.rb


chdir /var/redmine
exec bundle exec unicorn_rails -c ${CONF} -E ${ENVIROMENT}

中身はほとんど説明不要だと思います。/var/redmineにインストールしたredmineを起動しています。envでPATHなどの環境変数を指定しています。

使い方

redmine起動

sudo initctl start redmine

redmine終了

sudo initctl stop redmine

はまったところ

あたり前ですが、Unicorn起動時に-Dオプションは不要です。起動スクリプトからそのままコピペしてはまりました。

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9