[ubuntu-uk] shell script resque
Kaushal Shriyan
kaushalshriyan at gmail.com
Mon May 31 19:42:47 BST 2010
On Tue, Jun 1, 2010 at 12:05 AM, Bruno Girin <brunogirin at gmail.com> wrote:
> On Mon, 2010-05-31 at 23:34 +0530, Kaushal Shriyan wrote:
> > Hi,
> >
> >
> > I run the resque init script using /etc/init.d/resque start at
> > the command line which works perfectly fine while the machine is up
> > and
> > running fine, The issue is it doesnot come up automatically after
> > bootup.
>
> This is because /etc/init.d is just a repository for all
> startup/shutdown scripts. You then need to configure the script to start
> on certain run-levels and stop on others. Have a look at the wiki page
> on the subject [1] (the section titled "Installing custom init-scripts")
> or do: man update-rc.d
>
> [1] https://help.ubuntu.com/community/UbuntuBootupHowto
>
> Bruno
>
> >
> >
> >
> > root at hoststage:~# cat /etc/init.d/resque
> >
> > #!/bin/bash
> > # Author Kaushal Shriyan
> > # Date 31/05/2010
> > # Startup script for Resque Server
> >
> > touch /root/status
> > set -e
> >
> >
> start_resque=/usr/local/AddressBook/EntAddressBookDataStore/current/resque_cluster_start.sh
> >
> stop_resque=/usr/local/AddressBook/EntAddressBookDataStore/current/resque_cluster_stop.sh
> >
> > start() {
> > echo -n "Starting ResqueServer: "
> > ${start_resque}
> > echo "starting" >> /root/status
> > uptime >> /root/status
> > echo "done."
> > exit 0
> > }
> > stop() {
> > echo -n "Shutting down ResqueServer: "
> > ${stop_resque}
> > echo "done."
> > exit 0
> > }
> >
> > # See how we were called
> > case "$1" in
> > start)
> > start
> > ;;
> > stop)
> > stop
> > ;;
> > restart)
> > stop
> > sleep 10
> > start
> > ;;
> > *)
> > echo "Usage: $0 {start|stop|restart}"
> > esac
> > root at hoststage:~# cat /usr/local/AddressBook/EntAddressBookDataStore/
> >
> > current/resque_cluster_start.sh
> >
> > #!/bin/bash
> >
> >
> > cd /usr/local/AddressBook/EntAddressBookDataStore/current/
> > RAILS_ENV=production ./resque_start.sh > log/resque.1.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.2.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.3.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.4.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.5.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.6.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.7.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.8.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.9.log 2>&1 &
> > RAILS_ENV=production ./resque_start.sh > log/resque.10.log 2>&1 &
> > root at hoststage:~# ls
> > -l /usr/local/AddressBook/EntAddressBookDataStore/
> >
> >
> > current/resque_cluster_start.sh
> >
> > -rwxr-xr-x 1 root root 724 2010-05-31 04:50 /usr/local/AddressBook/
> >
> > EntAddressBookDataStore/current/resque_cluster_start.sh
> >
> >
> > #cat resque_start.sh
> > #!/usr/bin/env sh
> >
> >
> > # === GC settings =============
> > # twitter's settings
> > # TODO - set only for the forked process not the parent process
> > # export RUBY_HEAP_MIN_SLOTS=500000
> > # export RUBY_HEAP_SLOTS_INCREMENT=250000
> > # export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
> > # export RUBY_GC_MALLOC_LIMIT=50000000
> > # ============================
> >
> >
> > # required to start the redis server:
> > # redis-server <path to redis.conf>
> >
> >
> > # VVERBOSE=true level of verbosity - useful for debugging
> > # QUEUE=<value> the named queue to be polled
> > # INTERVAL=<seconds> the interval to sleep if there is no job in the
> > queue
> >
> >
> > # INTERVAL=60
> > QUEUE=contact_import /usr/bin/env rake -f /usr/local/AddressBook/
> > EntAddressBookDataStore/current/Rakefile resque:work #--trace
> >
> >
> > # start the redis-web app
> > #resque-web -p8282 config/initializers/load_resque.rb
> >
> >
> > # if [ -f "/usr/local/redis/redis.conf" ]; then
> > # /usr/local/redis/redis.conf/redis-server /usr/local/redis/
> > redis.conf
> > # else
> > # /usr/local/redis/redis.conf/redis-server /usr/local/redis/
> > redis.conf
> > # fi
> >
> >
> > root at hoststage:/etc/rc2.d#
> > lrwxrwxrwx 1 root root 23 2010-05-27 06:06 S20nvidia-kernel -> ../
> > init.d/nvidia-kernel
> > lrwxrwxrwx 1 root root 16 2010-05-31 05:19 S20resque -> ../init.d/
> > resque
> > lrwxrwxrwx 1 root root 20 2010-05-31 05:19 S20resque_web
> > -> ../init.d/
> > resque_web
> > root at hoststage:/etc/rc3.d# ls -l
> > total 4
> > lrwxrwxrwx 1 root root 16 2010-05-31 05:19 S20resque -> ../init.d/
> > resque
> > lrwxrwxrwx 1 root root 20 2010-05-31 05:19 S20resque_web
> > -> ../init.d/
> > resque_web
> > root at hoststage:/etc/rc3.d#
> > total 4
> > lrwxrwxrwx 1 root root 16 2010-05-31 05:19 S20resque -> ../init.d/
> > resque
> > lrwxrwxrwx 1 root root 20 2010-05-31 05:19 S20resque_web
> > -> ../init.d/
> > resque_web
> > root at hoststage:/etc/rc2.d#
> > total 4
> > lrwxrwxrwx 1 root root 16 2010-05-31 05:19 S20resque -> ../init.d/
> > resque
> > lrwxrwxrwx 1 root root 20 2010-05-31 05:19 S20resque_web
> > -> ../init.d/
> > resque_web
> > root at hoststage:/etc/rc4.d#
> > total 4
> > lrwxrwxrwx 1 root root 16 2010-05-31 05:19 S20resque -> ../init.d/
> > resque
> > lrwxrwxrwx 1 root root 20 2010-05-31 05:19 S20resque_web
> > -> ../init.d/
> > resque_web
> > root at hoststage:/etc/rc5.d#
> >
> >
> > Please suggest further.
> >
> >
> > Thanks and Regards
> >
>
>
>
> --
> ubuntu-uk at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
> https://wiki.ubuntu.com/UKTeam/
>
Hi Bruno,
root:~# update-rc.d resque start 51 S .
Adding system startup for /etc/init.d/resque ...
/etc/rcS.d/S51resque -> ../init.d/resque
did not work this time too
Please suggest
Kaushal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20100601/a12b7ff6/attachment.htm
More information about the ubuntu-uk
mailing list