Home > bash > Name of Rake task in ps output?

Name of Rake task in ps output?

April 13Hits:1
Advertisement
pid = `ps -ef | grep -v grep | grep rake | awk '{print $2}'` 

This is a bunch of ruby code that executes piped linux commands. While I usually just use ps aux, just because, I noticed that the rake task it finds outputs the path like so:

deployer 10149   1  0 Apr11 ?    00:01:08 /home/dude/.rvm/gems/ruby-1.9.3-p194/bin/rake  

If this rake task was ran from inside a bash script with:

RAILS_ENV=production bundle exec rake qc:work & 

Is there a way to find qc:work or some kind of identifier, just in case i run more than one rake task in the future? Maybe ps isn't what is needed, since I run with the &... although I tried bg with no luck.

Tags:bash, ruby

Related Articles

  • Name of Rake task in ps output?April 13

    pid = `ps -ef | grep -v grep | grep rake | awk '{print $2}'` This is a bunch of ruby code that executes piped linux commands. While I usually just use ps aux, just because, I noticed that the rake task it finds outputs the path like so: deployer 1014

  • How do I pass command line arguments to a rake task?May 5

    I've got a rake task that I am making that needs to insert a value into multiple databases. I'd like to be able to pass this value into the rake task from the command line, or from another rake task, how can I do this? --------------Solutions--------

  • How to perform a rake task after startup?May 19

    I'm using Rails, and I'd like to perform a specific rake task on boot. I've made a shell script like so: cd /path/to/my/app rake db:backup which is symlinked in /etc/rc2.d/. The problem is that the script is run as root which means it doesn't have ac

  • Simple rails rake task refuse to run with error "Don't know how to build task", why?October 15

    I have this simple rake task which refuses to run. I just don't see why it looks correct. Who can pinpoint me to the probably very simple mistake I made? Thank you! /lib/tasks/reindex.rb: namespace :db do desc "Tire reindex profiles" task :reind

  • Execute gitlab sidekiq (rake task) with upstartJuly 12

    I'm trying start the gitlab sidekiq daemon through upstart. But unfortunately it seems that the sidekiq worker is respawned since sidekiq start deamonizes itself: Jul 12 17:26:42 git kernel: [370722.042968] init: gitlab-sidekiq main process (28251) t

  • How do rails project know about rake tasks from other repositoriesSeptember 29

    We have a rake task called db:sanity_check which exists in a 'core' repo. Other repositories that we have also show this rake task. But they do not define the rake task. It 'comes' from core' How do these other repositories know about the rake tasks

  • Adding postgis geometry with rake taskJune 30

    I have a postgres table test with a geometry column: Column | Type | Modifiers ------------------------+------------------------+---------------------------------------------------------------------------------- id | integer | not null default nextva

  • How to use devise helpers in a rake task?January 14

    My task will do the following: Check if a user is signed in, and notify it to an admin If true => do nothing If false => send an email to an admin I want this task to be executed every hour (it will be scheduled with Heroku Scheduler add-on) The pro

  • Ruby on Rails rake task - CSV::MalformedCSVError - Allow forward slashes in cell?January 15

    Here's a quick example of my CSV file name,xyz,find_id,phase_id TRACE / TRACK,,60,1 and I have a rake task that looks like this namespace :sample do task :import => :environment do exampl1 = [] CSV.foreach('lib/tasks/example_file.csv', :headers => t

  • Opening a zip file that contains a csv file to use in a rake taskJanuary 15

    I have a rake task that looks like this require 'open-uri' require 'csv' namespace :Table do task reload: :environment do ActiveRecord::Base.connection.execute("TRUNCATE Table RESTART IDENTITY") csv_text = open('URL') csv = CSV.parse(csv_text, :

  • Calling a ruby script which contains a system ('make') command from rake taskJanuary 18

    I have a file with rake tasks (project_task.list). One of my tasks is just to call a ruby script: define_task "call_ruby_script" do description("Call the ruby_script.rb") rake_task do task :call_ruby_script do ruby "#{$PROJECT}/01

  • Rake task replies with undefined method `created_at' – can't access columnsJanuary 19

    For some reason I cannot access columns in tables through ActiveRecord using a rake task. My rake task looks like this: task :reminder => :environment do User.all.each do |user| if user.entries.last.created_at.strftime("%A, %d of %B %Y") == 3

  • Rake task to update specific products in dbJanuary 20

    Hi all I've got a database full of products and I need to schedule a rake task to run every week. I'm not exactly sure how to code the rake task. An example would be I have a product with id=1 name="testname" description="description"

  • Rails populate db rake task OpenURI::HTTPError: 500 Internal Server ErrorJanuary 20

    I am trying to make rake task to populate db from JSON API fixer.io, but when i type my rake : rake db:populate this error occurs: OpenURI::HTTPError: 500 Internal Server Error /home/jakub/Documents/workspace/exch/lib/tasks/populate.rake:16:in `block

  • Rspec Rake Task: How to parse a parameter?January 21

    I have a rake task which generates a new User. Values of email, password and password_confirmation (confirm) needs to be typed in through the command line. This is my rake task code: namespace :db do namespace :setup do desc "Create Admin User"

  • Rake task dependency for namespaceJanuary 26

    Is it possible to define a rake task dependency for all rake tasks under a given namespace? Particularly the db namespace. I was hoping for something like this: namespace db: :my_dependency do task :create task 'schema:load' ... etc ... end But this

  • Ruby rake tasks thread optimizationJanuary 27

    I have some rake tasks that need to run every hour approximately, each one of them has to contact a web site, download a file and import the file into my db. I was wondering what the best approach would be in terms of efficiency and speed of executio

  • Programming reoccurring daily, weekly and monthly events through a rake task

    Programming reoccurring daily, weekly and monthly events through a rake taskJanuary 28

    I need some help figuring out how to program reoccurring (Daily, Weekly and Monthly) events in my rails app. I am planning on using a rake task and also the Heroku Scheduler to do my scheduling jobs in production. I have looked into gems like ice_cub

  • How to use current_user method in rake task railsFebruary 2

    I creating a rake task for sending SMS to user from an Organisation which is signed in as current_user and I have to send the organisation name in the end which is stored in the organisation table. But the problem is that current_user method is not a

  • Rake task to send users a reminder to post with conditionsFebruary 8

    I am implementing a feature that reminds users to make a post via email if the user has set daily reminders to true he has not posted yet today and if the current hour matches when he would like to receive the daily reminder in his time zone. I am go

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.287 s.