Jump to content


Photo

Running as a daemon so i can start stop etc


  • Please log in to reply
1 reply to this topic

#1 neilstreet6036

neilstreet6036

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 27 July 2014 - 09:31 AM

Hi

 

How can I run VW as a daemon so that I may start and stop it?

 

Thanks,

 

Neil.



#2 Felix

Felix

    Member

  • Members
  • PipPip
  • 19 posts

Posted 27 July 2014 - 05:40 PM

You can run it as a daemon.  In the Low Cost Alarm Project (see http://www.catalinac...ostAlarmProject) in the "Wrap Up" section at the end, there's an example.

 

First, you will probably want a Scripts/user/startup.script file which creates your system.  Each time you start VW, whatever is in the startup.script file gets run.

 

Next you need to run VW as a daemon.  In the top level of your VW directory, there's a file called rc_local.script.  If you run this from the command line, it will start VW in the background as a daemon.  You can also call this file from /etc/rc.local, which will start up VW each time your host boots.

 

If you want to stop VW, find the processes associated with VW by typing from the command line:

 

ps x | grep ruby

 

You should see something like:

 

 3588 ?        Sl     0:01 ruby ./run_vw_application.rb -p 4567

 3596 ?        Sl     0:00 ruby ./run_padrino.rb 4567 ../virtualizer/virtualizer_standalone.config -e production -s start_script=[Scripts/user/startup.script]

 3598 ?        Sl     0:20 /home/pi/.rvm/gems/ruby-2.0.0-p353@vw/bin/padrino                                                                                                            

 3609 ?        Sl     0:05 ruby ./run_with_retry.rb ./virtualizer.rb virtualizer_standalone.config -s start_script=[Scripts/user/startup.script]

 3612 ?        Sl     0:19 ruby ./virtualizer.rb virtualizer_standalone.config -s start_script=[Scripts/user/startup.script]

 3685 pts/0    S+     0:00 grep --color=auto ruby

 
The first 5 processes are VW (the last is our grep command).
 
Starting at the top process (here it's 3588), kill the 5 processes (kill 3588; kill 3596 .....).  Your VW daemon is stopped.

 

This is a question others will probably ask  - it should be listed in the FAQs.  I'll look into adding it.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users