Permalink
Browse files

Adding Upstart files, ensure jobs run after reboot

  • Loading branch information...
1 parent 4d8bd66 commit 71e631ea23e368682f2c8fc80045c9692ef1a17a @swaroopch committed Jul 29, 2011
Showing with 39 additions and 0 deletions.
  1. +12 −0 README.textile
  2. +9 −0 upstart/isbn.net.in-job-1.conf
  3. +4 −0 upstart/isbn.net.in-job.conf
  4. +14 −0 upstart/isbn.net.in.conf
View
12 README.textile
@@ -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@
+-->
View
9 upstart/isbn.net.in-job-1.conf
@@ -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
View
4 upstart/isbn.net.in-job.conf
@@ -0,0 +1,4 @@
+start on starting isbn.net.in
+stop on stopping isbn.net.in
+
+# vim: ft=upstart
View
14 upstart/isbn.net.in.conf
@@ -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.