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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:10:15+00:00 2026-05-13T16:10:15+00:00

I have the feeling that I’m missing the obvious, but have not succeeded with

  • 0

I have the feeling that I’m missing the obvious, but have not succeeded with man [curl|wget] or google (“http” makes such a bad search term). I’m looking for a quick&dirty fix to one of our webservers that frequently fails, returning status code 500 with an error message. Once this happens, it needs to be restarted.

As the root cause seems to be hard to find, we’re aiming for a quick fix, hoping that it will be enough to bridge the time until we can really fix it (the service doesn’t need high availability)

The proposed solution is to create a cron job that runs every 5 minutes, checking http://localhost:8080/. If this returns with status code 500, the webserver will be restarted. The server will restart in under a minute, so there’s no need to check for restarts already running.

The server in question is a ubuntu 8.04 minimal installation with just enough packages installed to run what it currently needs. There is no hard requirement to do the task in bash, but I’d like it to run in such a minimal environment without installing any more interpreters.

(I’m sufficiently familiar with scripting that the command/options to assign the http status code to an environment variable would be enough – this is what I’ve looked for and could not find.)

  • 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-13T16:10:15+00:00Added an answer on May 13, 2026 at 4:10 pm

    I haven’t tested this on a 500 code, but it works on others like 200, 302 and 404.

    response=$(curl --write-out '%{http_code}' --silent --output /dev/null servername)
    

    Note, format provided for –write-out should be quoted.
    As suggested by @ibai, add --head to make a HEAD only request. This will save time when the retrieval is successful since the page contents won’t be transmitted.

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

Sidebar

Related Questions

I have a feeling that I'm missing something obvious but can't seem to resolve
I have that sneaking feeling I'm missing something obvious: I ran RAILS_ENV=production bundle exec
I have a feeling that this probably is not possible using strictly CSS, but,
I have a feeling that I'm missing something simple here but can't seem to
I have a feeling that I already know the answer to this one, but
I have a feeling that there must be client-server synchronization patterns out there. But
I have a feeling that the answer to this is easy but I can't
I have created a few UIImageViews programmatically, but I have a feeling that even
I have the feeling that I should not care about thread safe accessing /
I have a feeling that the title just might not be explanatory :) Setup

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.