Last active
February 2, 2016 18:49
-
-
Save p0c/36075951623a9b9178cd to your computer and use it in GitHub Desktop.
shell function sleep until
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sleep_until() { | |
current_time=$(date +%s) | |
target_time=$(date -d "$*" +%s) | |
seconds=$(( $target_time - $current_time )) | |
sleep $seconds | |
} | |
# Usage: | |
# sleep_until tomorrow 11:50 | |
# sleep_until 24 hours | |
# sleep_until 2015-02-19 11:50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment