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

  • Home
  • SEARCH
  • 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 155077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:05:30+00:00 2026-05-11T10:05:30+00:00

I want my bash script to sleep until a specific time. So, I want

  • 0

I want my bash script to sleep until a specific time. So, I want a command like ‘sleep’ which takes no interval but an end time and sleeps until then.

The ‘at’-daemon is not a solution, as I need to block a running script until a certain date/time.

Is there such a command?

  • 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. 2026-05-11T10:05:31+00:00Added an answer on May 11, 2026 at 10:05 am

    As mentioned by Outlaw Programmer, I think the solution is just to sleep for the correct number of seconds.

    To do this in bash, do the following:

    current_epoch=$(date +%s) target_epoch=$(date -d '01/01/2010 12:00' +%s)  sleep_seconds=$(( $target_epoch - $current_epoch ))  sleep $sleep_seconds 

    To add precision down to nanoseconds (effectively more around milliseconds) use e.g. this syntax:

    current_epoch=$(date +%s.%N) target_epoch=$(date -d '20:25:00.12345' +%s.%N)  sleep_seconds=$(echo '$target_epoch - $current_epoch'|bc)  sleep $sleep_seconds 

    Note that macOS / OS X does not support precision below seconds, you would need to use coreutils from brew instead → see these instructions

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

Sidebar

Related Questions

I have a little Bash script which suspends the computer after a given number
I want to launch a bash script when a button is pressed on a
Let's say I've got a shell script called print_error.sh looking like this: #!/usr/bin/bash echo
I want to write a script that will: 1- locate folder store on a
Suppose we have a BASH script running some commands in the background. At some
I have created a simple bash script, chmod +x, and successfully am running it
I have a bash script that sources contents from another file. The contents of
I'm trying to write a helper function to use in a bash script to
I want to create cron job that runs a script every 5 seconds. Seeing
Every time that I want to do a Layout, I'm getting a black layout

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.