Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Heisman
    Senior Member
    • Dec 2010
    • 534

    #1

    Are sleep/pause commands in bash scripts ever necessary?

    Hey all,

    Just a question from a novice computer guy; I am doing a lot of targeted capture analysis and basically have a script where commands are run one after the other (ie, align data, convert to .bam, sort, remove duplicates, etc). Without any type of sleep/pause commands between the steps, do I ever have to worry about the script moving on to the next command before the previous one is complete? I've been including them just to be careful but now I want to speed things up as much as possible (without risking screwing up the analysis). Are there scenarios where I do have to be careful about this? Thanks for any input!
  • vyellapa
    Member
    • Oct 2011
    • 59

    #2
    Not unless there is a task completion dependency from another script. For example, you want to merge two bam's, then merge step should wait for the two input bams to be ready to be merged.

    For serial processing, sleep makes little sense

    Comment

    • Heisman
      Senior Member
      • Dec 2010
      • 534

      #3
      Ah, cool; if I'm having multiple scripts interact that makes sense. I wasn't sure if there was any chance for a script to move on to the next command while the previous command was still outputting data, for example. If not that's great.

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        Unless the sleep commands are waiting for very long (~ hour instead of few mins, do not go on the large number since that is in seconds) it may be best to leave them alone.

        Sounds like someone wrote these scripts for you and may have put these commands in deliberately to allow the disk writes to complete etc.

        Comment

        • Heisman
          Senior Member
          • Dec 2010
          • 534

          #5
          That's what I was particularly wondering about; nobody wrote this for me but I was originally advised to include them (maybe not great advice, though). I've analyzed a couple samples worth of data after taking them out and it ran fine with equivalent results, but I want to be sure it will always be fine, if that makes sense.

          Comment

          • GenoMax
            Senior Member
            • Feb 2008
            • 7142

            #6
            Out of curiosity what is the wait time that you have currently included? Is that truly impacting what you need to do negatively?

            Comment

            • Heisman
              Senior Member
              • Dec 2010
              • 534

              #7
              Relatively small, like 3 seconds at multiple steps.There's a lot of samples to crank through so it adds up. However, to be honest, I just like understanding what's going on, haha. IE, does a bash script continue on to the next step when the previous step's PID disappears? If so, and I'm converting a sam file to a bam file with samtools, does that PID go away only after everything is written?

              Comment

              • GenoMax
                Senior Member
                • Feb 2008
                • 7142

                #8
                Sounds like you are going to remove the sleep/pause statements to get those 3 seconds back.

                Go for it

                On a serious note - the script would likely go to the next step as soon as the first one finishes. If you are not using fast/enterprise level storage the writes could in theory be lagging. I do not know for sure. Perhaps someone with more experience can comment.

                Comment

                • Heisman
                  Senior Member
                  • Dec 2010
                  • 534

                  #9
                  I'm going for it! Wish I could figure out a legit reason to include or not include them; that has to be documented somewhere.

                  Comment

                  Latest Articles

                  Collapse

                  • SEQadmin2
                    Beyond CRISPR/Cas9: Understand, Choose, and Use the Right Genome Editing Tool
                    by SEQadmin2



                    CRISPR/Cas9 sparked the gene editing revolution for both research and therapeutics.1 But this system still showed severe issues that limited its applications. The most prominent were the heavy reliance on PAM sequences, delivery limitations, double-stranded breaks that prompt unintended edits and cell death, and editing inefficiency (both in targeting and in knock-in reliability).

                    Despite this, “CRISPR helped turn genome editing from a specialized technique into
                    ...
                    Today, 11:01 AM
                  • SEQadmin2
                    Proteomic Platforms: How to Choose the Right Analytical Strategy to Improve Detection and Clinical Applications
                    by SEQadmin2


                    Proteomics platforms are evolving rapidly, with advances in mass spectrometry and affinity-based approaches expanding what researchers can detect and at what scale. As the field moves toward deeper proteome coverage and clinical applications, scientists face an increasingly complex landscape of tools. This article will explore how researchers are navigating these choices to find the right platform for their work.

                    The systematic characterization of the human proteome has
                    ...
                    07-20-2026, 11:48 AM
                  • SEQadmin2
                    Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                    by SEQadmin2



                    Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                    ...
                    07-09-2026, 11:10 AM

                  ad_right_rmr

                  Collapse

                  News

                  Collapse

                  Topics Statistics Last Post
                  Started by SEQadmin2, Today, 02:55 AM
                  0 responses
                  7 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 07-24-2026, 12:17 PM
                  0 responses
                  12 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 07-23-2026, 11:41 AM
                  0 responses
                  12 views
                  0 reactions
                  Last Post SEQadmin2  
                  Started by SEQadmin2, 07-20-2026, 11:10 AM
                  0 responses
                  24 views
                  0 reactions
                  Last Post SEQadmin2  
                  Working...