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 7721587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:57:43+00:00 2026-06-01T03:57:43+00:00

I am currently creating a Dashboard app which is created with Ruby on Rails.

  • 0

I am currently creating a Dashboard app which is created with Ruby on Rails.

I have added a Server model and controller and the same for Ping.

What I want is to run the ping command on the given server IP address.

How would I go about this and log the results (status and M/S) into the database?

I would also like to know how to run the command every minute.

  • 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-06-01T03:57:44+00:00Added an answer on June 1, 2026 at 3:57 am

    Probably the easiest way would be to open a TCP socket:

    require 'timeout'
    require 'socket'
    
    def ping(host)
      begin
        Timeout.timeout(5) do 
          s = TCPSocket.new(host, 'echo')
          s.close
          return true
        end
      rescue Errno::ECONNREFUSED 
        return true
      rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH
        return false
      end
    end
    
    ping('109.104.109.237')
    

    These uses TCP ping rather than ICMP so a firewall would need to be configured as appropriate.

    Running this every minute can be achieve using something like:

    loop do
      # do your ping tests
      sleep 60
    end
    

    and running that process all the time. You can look at something like Daemons (http://daemons.rubyforge.org/) if you want an easy way to background it.

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

Sidebar

Related Questions

I'm currently creating a Rails app with some cronjobs etc, but I have some
I have a rails app that is using Devise, with a User model, no
I'm currently creating both the client and server app using ActiveResource for web servicing.
im currently creating a graph for an app, using coreplot and have a problem
I am currently creating an iOS app, which connects to a database and asynchronously
I am creating a portal type dashboard for our app. The controls are added
I am currently creating a app in which i want to let the user
I'm currently creating a Wordpress theme and I have an area which displays the
I am currently creating an e-commerce site using C# ASP.NET MVC and have just
I am currently creating a console application which is reading from a folder which

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.