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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:39:34+00:00 2026-05-28T06:39:34+00:00

How do I avoid breaking the HD? I have a bash script running on

  • 0

How do I avoid breaking the HD? I have a bash script running on an ubuntu machine, with this meta code:

bash1.sh

while(true)
 run bash2.sh
 sleep 60 seconds
done

bash2.sh:

if(directory is empty): exit
process file
delete file

The directory is network shared, and the computer is not doing anything else. Once per day a new file arrives and is processed. (I do know that bash1.sh can be replaced by watch). My concern is that bash1.sh is reading bash2.sh everytime – that can presumably be avoided by only having one script!? and bash2.sh is reading the same directory everytime. Is the directory really read from the HD, or is ubuntu somehow caching the dir in ram? -so it is only read when something changes? is it a problem that it is the same place on the HD that is read every time, or does it not matter because the HD is already spinning? If the HD never sleeps, does it matter if I set the loop time down to only one second?

Maybe the directory could be a pure ram dir – how do I do that? -or is there some simple way to check if something has arrived over the network without reading the directory?

  • 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-28T06:39:35+00:00Added an answer on May 28, 2026 at 6:39 am

    Reading a file or directory once every sixty seconds is not excessive use.

    Seriously, don’t worry about it.


    If it’s really worrying you, you can rethink your strategy for detecting the file.

    For example, do you really need to know, within sixty seconds, that the file has arrived? Can it arrive any time during the day? Can some parts of the day be considered unlikely?

    Using information like that, you can adjust the timing of checks to suit. If the file is supposed to be delivered after 4pm, don’t check for it at all before then.

    Check for it every sixty seconds between 4pm and 5pm, then every ten minutes after that.

    These are all business-related decisions that can be made but I would still suggest that it’s unnecessary. Provided you regularly back up your disks (and have standby hardware if you need to be back up in a hurry), you shouldn’t lose anything.

    In fact, if you were really paranoid, you could dedicate an entire machine for this, whose sole purpose is to receive the file via FTP and, when it arrives, send it across to your real processing box.

    Put nothing else on that machine and have a warm standby (exactly same software, IP address and so on but powered down) so that, if it fails, the standby can be activated in minutes.

    The real processing machine is then only written to once a day – that’s unlikely to affect the disk lifetime.

    That’s probably too paranoid for my liking but it shows that there are ways to mitigate almost any problem.

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

Sidebar

Related Questions

I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET
I frequently have code that looks something like this: if (itm != null) {
I have a problem caused by breaking strict pointer aliasing rule. I have a
I'm relatively(read: stupid newbie) familiar with disassembly but this bit stumped me: I have
I'd like to avoid the debugger breaking into a series of validation helper methods
I have a large amount of python code that tries to handle numbers with
In the book Clean Code (and a couple of others I have come across
Edit: I have looked at the answers code: NONE of them do what I
How do I avoid read locks in my database? Answers for multiple databases welcome!
After trying to avoid JavaScript for years, Iv started using Query for validation in

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.