startup script for jobsworth

85 views
Skip to first unread message

badb...@gmx.de

unread,
May 23, 2013, 4:32:59 AM5/23/13
to jobs...@googlegroups.com

hello i made a little startup script so after a reboot the background processor and delayed job worker are started

#!/bin/bash
# chkconfig: 235 99 10
# description: start or stop jobsworth
#
### BEGIN INIT INFO
# Provides: jobsworth
# Required-Start: $network $mysqld $httpd                         
# Required-Stop: $network
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: start or stop jobsworth
### END INIT INFO

PATH="/usr/local/rvm/gems/ruby-1.9.3-p429/bin:/usr/local/rvm/gems/ruby-1.9.3-p429@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p429/bin:/usr/local/rvm/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/rvm/bin:"

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#. /etc/init.d/functions
log_daemon_msg() { logger "$@"; }
log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }

case "$1" in
'start')

log_daemon_msg "Starting Jobsworth Services"

cd /jobsworth/jobsworth-master

RAILS_ENV=production bundle exec script/scheduler.rb restart

echo "start delayed job worker."

RAILS_ENV=production bundle exec script/delayed_job restart

log_end_msg 0

;;

'stop')

log_daemon_msg "Stopping Jobsworth Services"

cd /jobsworth/jobsworth-master

echo "stop the background processor."

RAILS_ENV=production bundle exec script/scheduler.rb stop

echo "stop delayed job worker."

RAILS_ENV=production bundle exec script/delayed_job stop

log_end_msg 0

;;

'restart')

log_daemon_msg "Restarting Jobsworth Services"

cd /jobsworth/jobsworth-master

echo "restart the background processor."

RAILS_ENV=production bundle exec script/scheduler.rb restart

echo "restart delayed job worker."

RAILS_ENV=production bundle exec script/delayed_job restart

log_end_msg 0

;;

 

'status')

log_daemon_msg "Status Jobsworth Services"

cd /jobsworth/jobsworth-master

echo "status background processor."

RAILS_ENV=production bundle exec script/scheduler.rb status

echo "status delayed job worker."

RAILS_ENV=production bundle exec script/delayed_job status

 

log_end_msg 0

;;

*)

echo "Usage: $0 {status | start | stop | restart }"

;;

esac

exit 0

 

Vikrant Chaudhary

unread,
May 24, 2013, 5:14:55 AM5/24/13
to jobs...@googlegroups.com
This is nice effort.
In upcoming 4.0 release, background processes are done within the main
process so no separate script would be required.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "jobsworth" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jobsworth+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages