Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Commit

Permalink
Adding Upstart files, ensure jobs run after reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
swaroopch committed Jul 29, 2011
1 parent 4d8bd66 commit 71e631e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@ h2. Rails

h2. delayed_job

For development:

@foreman start@

For Ubuntu Linux / production:

Edit @CODEDIR@ path in @upstart/isbn.net.in-job-1.conf@
@sudo cp -v upstart/* /etc/init/@
@sudo start isbn.net.in@

<!--
@mkdir -p tmp@
@foreman -u <your username> export upstart tmp@
@sudo cp -v tmp/isbn.net.in*.conf /etc/init/@
@sudo start isbn.net.in@
-->
9 changes: 9 additions & 0 deletions upstart/isbn.net.in-job-1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
start on starting isbn.net.in-job
stop on stopping isbn.net.in-job
respawn

env CODEDIR="/home/swaroop/web/isbn.net.in/private/isbn.net.in"

exec su -l swaroop -c "cd $CODEDIR; export PORT=5000; bundle exec rake RAILS_ENV=production jobs:work >> /var/log/isbn.net.in/job-1.log 2>&1"

# vim: ft=upstart
4 changes: 4 additions & 0 deletions upstart/isbn.net.in-job.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
start on starting isbn.net.in
stop on stopping isbn.net.in

# vim: ft=upstart
14 changes: 14 additions & 0 deletions upstart/isbn.net.in.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]

pre-start script

bash << "EOF"
mkdir -p /var/log/isbn.net.in
chown -R swaroop /var/log/isbn.net.in
EOF

end script

# vim: ft=upstart

0 comments on commit 71e631e

Please sign in to comment.