Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:53:02+00:00 2026-05-23T12:53:02+00:00

In terminal i write: ruby lib/scripts/script.rb In on script.rb I have 2 scripts… script.rb

  • 0

In terminal i write: ruby lib/scripts/script.rb

In on script.rb I have 2 scripts…

script.rb

    require 'config/environment'

    #first script
#notifier user that question deadline is over and show statistics
inquiry.each do |i|   
    question          = i.question 

    #respondent        = Respondent.find(:all, :conditions => ["id = (?)", i.respondent_id])
    respondent        = i.respondent

    #Notifier.deliver_deadline_notification(inquiry, user, question, respondent)
     Notifier.deliver_statistics_notification(inquiry, question, user, respondent)

    #respondent        = Respondent.find(:all, :conditions => ["id = (?)", i.respondent_id])
    #respondents.each do |r|         
    #end
end

—————–

    #second script
respondents       = Respondent.find(:all)
inquiries         = Inquiry.find(:all, :conditions => ["is_answered = 0 AND respondent_id = (?)", respondents])
#respondents       = Respondent.find(:first, :conditions => ["id = (?)", inquiries])

questions       = Question.find(:all) 
qdead           = questions.deadline

dead_line_date  = qdead - 1.days - 0.minutes - 0.seconds 
get_time_now    = Time.now.strftime('%m/%d/%Y') 

I have those 2 scripts (1 script do something ,and second is another) in one rb file. My question is… How do I can write in console to launch 1st script and 2nd script simultaneously? I know i use some AGVG ? But How?

Thank you very much!

UPD:
using cron i wrote:

0 0 * * * /usr/bin/rails-run-script myproject script oncoming

0 1 * * * /usr/bin/rails-run-script myproject script missed

d

oncoming and missed – arguments. How i can deprecate them in my script.rb. How script will know that Im using missed or oncoming ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:53:02+00:00Added an answer on May 23, 2026 at 12:53 pm

    If I get your question right, what you have is a script that behaves differently based on the command line argument you pass to the script, right?

    So script missed does a and script oncoming does something else.

    If it’s really just as simple as that, you could simply decide on ARGV.first.

    case ARGV.first 
    when "oncoming"
      # your "oncoming" logic (preferably wrapped in a method call) here
    when "missed"
      # your "missed" logic
    else
      $stderr.puts "Call the script with either missed or oncoming" 
      exit 1
    end
    

    however, if you want to do anything slightly more complex with options, I’d highly recommend using optparse.rb which is included in rubys stdlib (http://ruby-doc.org/stdlib/libdoc/optparse/rdoc/index.html)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Ruby script that I built in TextMate and can successfully run
The problem is that, when I write su in terminal emualator, I have su:uid
I want to write a simple chat-client in Ruby for the terminal. The Problem
I would like to write a Java terminal application that does screen manipulation. Are
I have a piece of code that invokes an instance of the bash terminal
I started to write a terminal text editor, something like the first text editors
I'm trying to write a very simple terminal app that will scan for Bluetooth
I need to write a simple terminal-based program that should, Read some text from
I need a script that can write text to an exsisting file starting on
I just have begun with Perl and I want to write my own script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.