linux - how to daemonize Rails Rake task on Elastic Beanstalk start up -


I have an elastic Beanstock web server environment called "mine-NV" I want to start my Execute the following bass command: bundle exec rake jobs: work . I am new to EB and my bash is mediocre (best). I talked about the whole day yesterday and came up with the following: .exextensions / start_worker.config :

Edit: < Actually, the following is not working correctly; It seems that the work is starting to function properly and then the errors begin to create. Maybe the environment changes?

  command: create_post_dir: Command: "mkdir / opt / elasticbeanstalk / hooks / appdeploy / post" Undiscovered Errors: True Files: "/usr/sbin/jobs_worker.sh": Mode: "000755 "Owner: Root Group: Root content: | #! / Usr / bin / env bash / opt / elasticbeanstalk / support / envvars Export PATH = / home / ec2-user / .gem / ruby ​​/ 2.1.2 / bin: /opt/rubies/ruby-2.1.2/lib /ruby/gems/2.1.0/in Bin: /opt/rubies/ruby-2.1.2/bin: / usr / local / bin: / bin: / usr / bin: / usr / local / sbin: / usr / sbin : / Sbin: / opt / AWS / bin / home / ec2-user / bin cd $ EB_CONFIG_APP_CURRENT su -c "RAILS_ENV = Product Bundle Execution Rack Jobs: Work" $ EB_CONFIG_APP_USER "Start of Worker" echo & gt; /var/log/directory-hooks-executor.log "/opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh": Mode: "000755" Owner: Root Group: Root content: | #! / Usr / bin / env bash nohup /usr/sbin/jobs_worker.sh 0 & lt; & Amp; - & amp; & Gt; /var/log/directory-hooks-executor.log & amp;   

So it creates a script in / opt / elasticbeanstalk / hooks / appdeploy / post , so when executing the EB it automatically executes it I had to do a dynamics so that script could not stop the introduction of the eb sequence.

So I doubt that this is going to work well for a long time. I would appreciate any advice on how cleaner it can be; Maybe through a Linux service, or within a rail initiator Apart from this, I would like to know if there is a danger that this script will run more than once or stop unexpectedly. So I think I am asking for any general advice that how can I move forward from the best here? I believe I have found a suitable solution I installed the dark red gemstone: "daemon"

  command: create_post_dir: command: "mkdir / opt / elasticbeanstalk / hook / appdeploy / post" ignoreErrors: true webapp_pids: command: "mkdir / home / webapp / PID "ignoreErrors: true files:" /opt/elasticbeanstalk/hooks/appdeploy/post/99_restart_delayed_job.sh ": Mode:" 000755 "Owner: Root Group: Root content: | #! / Usr / bin / env bash / opt / elasticbeanstalk / support / envvars chown webapp: webapp / home / webapp / su -l "c" $ EB_CONFIG_APP_CURRENT / bin / delayed_job --pid-dir = / home / webapp / PID restart "$ EB_CONFIG_APP_USER Echo" worker started "& Gt; & Gt; /var/log/directory-hooks-executor.log   

So far it seems to work.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -