On Tue, Jun 1, 2010 at 1:25 AM, Bruno Girin <[email protected]> wrote:
> On Tue, 2010-06-01 at 00:12 +0530, Kaushal Shriyan wrote: > > > > > > On Tue, Jun 1, 2010 at 12:05 AM, Bruno Girin <[email protected]> > > 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 > > > > > > > > > > > > > > > > r...@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 > > > r...@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 & > > > r...@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 > > > > > > > > > r...@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 > > > r...@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 > > > r...@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 > > > r...@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 > > > r...@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 > > > r...@hoststage:/etc/rc5.d# > > > > > > > > > Please suggest further. > > > > > > > > > Thanks and Regards > > > > > > > > > > > > > -- > > [email protected] > > 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 > > The example on the wiki is not great. You probably want the service to > start on run levels 2, 3, 4 and 5, after everything else has started; > and stop on run level 0, 1 and 6 before anything else stops, in which > case, you would issue the following: > > update-rc.d resque start 98 2 3 4 5 . stop 02 0 1 6 . > > Alternatively, there is a "defaults" form that does the same thing but > is a bit simpler: > > update-rc.d resque defaults 98 02 > > The '98' is the start order while the '02' is the stop order, both being > values between 00 and 99. So the commands above will ensure that your > service starts very late in the sequence (so everything it depends on > should already be started) but is stopped very early when the machine > shuts down. > > And don't forget to remove the /etc/rcS.d/S51resque symlink you > accidentally created earlier by following the wiki. > > For some background info, Linux (and any other System V operating system > like Sun Solaris) uses run levels to manage what services start and stop > during startup and shutdown. Run levels 2, 3, 4 and 5 are the standard > multi-user modes and are identical on a default install, 0 is the run > level used when shutting down, 1 when in single user mode and 6 when > rebooting. More details on debiandadmin [1]. > > By default, a Ubuntu box will start in run level 2. Run levels 3, 4 and > 5 are generally not used but are made available so that you could > customise them and have specific services running only in controlled > circumstances. For example Solaris used to (and maybe still does) have > core services started on run level 2 but added extra services that were > considered potentially unsafe in run level 3 (such as the telnet and ftp > daemons). By doing this, you could easily start all those services by > changing to run level 3 and stop them again by dropping to run level 2. > > [1] http://www.debianadmin.com/debian-and-ubuntu-linux-run-levels.html > > Bruno -- off to update the wiki with a more sensible example > > > > -- > [email protected] > https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk > https://wiki.ubuntu.com/UKTeam/ > Hi Bruno It did not worked this time too. Please suggest further. Thanks, Kaushal
-- [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk https://wiki.ubuntu.com/UKTeam/
