{"id":15882646,"url":"https://github.com/pzim-devdata/sleep_until","last_synced_at":"2025-10-04T23:26:12.548Z","repository":{"id":223637936,"uuid":"761105791","full_name":"pzim-devdata/sleep_until","owner":"pzim-devdata","description":"Sleep Until is a Bash script to wait for a specified astronomical event such as sunrise or sunset before continuing execution.","archived":false,"fork":false,"pushed_at":"2024-02-21T09:22:22.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T05:47:35.512Z","etag":null,"topics":["astronomical-time","bash-command","bash-command-line","bash-commands","linux","linux-command","linux-command-line","sleep","sleep-timer","sleep-tracker","sleep-until","sunrise","sunset","sunset-sunrise","wait","wait-for-it"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pzim-devdata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-21T08:51:03.000Z","updated_at":"2025-01-08T16:03:08.000Z","dependencies_parsed_at":"2024-02-21T10:00:43.335Z","dependency_job_id":null,"html_url":"https://github.com/pzim-devdata/sleep_until","commit_stats":null,"previous_names":["pzim-devdata/sleep_until"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pzim-devdata/sleep_until","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fsleep_until","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fsleep_until/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fsleep_until/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fsleep_until/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pzim-devdata","download_url":"https://codeload.github.com/pzim-devdata/sleep_until/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pzim-devdata%2Fsleep_until/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278386753,"owners_count":25978230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astronomical-time","bash-command","bash-command-line","bash-commands","linux","linux-command","linux-command-line","sleep","sleep-timer","sleep-tracker","sleep-until","sunrise","sunset","sunset-sunrise","wait","wait-for-it"],"created_at":"2024-10-06T04:06:00.139Z","updated_at":"2025-10-04T23:26:12.512Z","avatar_url":"https://github.com/pzim-devdata.png","language":"Shell","readme":"# Sleep Until\n\nSleep Until is a Bash script to wait for a specified astronomical event such as sunrise or sunset before continuing execution.\n\nIt automatically calculates the time of the event based on geographic location and suspends execution until the precise moment of the event today or the next day if the event has already happened.\n\n## Installation\n\nTo install sleep_until, run one of the following commands. It will be automatically added to your PATH: \n\n```\nsudo wget -O /usr/local/bin/sleep_until https://raw.githubusercontent.com/pzim-devdata/sleep_until/main/sleep_until\nsudo chmod +x /usr/local/bin/sleep_until\n```\n\nOr\n\n```\nsudo curl -o /usr/local/bin/sleep_until https://raw.githubusercontent.com/pzim-devdata/sleep_until/main/sleep_until\nsudo chmod +x /usr/local/bin/sleep_until\n```\n\nThis will download the script directly into /usr/local/bin, making it available globally.\n\n## Usage\n\nExample to wait for sunset (You must specify an event as first argument):\n\n```bash\nsleep_until sunset\n```\n\nSupported astronomical events:\n\n- sunrise\n- sunset\n- solar_noon\n- civil_twilight_begin \n- civil_twilight_end\n- nautical_twilight_begin\n- nautical_twilight_end \n- astronomical_twilight_begin\n- astronomical_twilight_end\n\n## Customization\n\nYou can customize the script by opening it in a notepad and modifying it:\n\n```bash\nsudo gedit /usr/local/bin/sleep_until\n```\n\n- If you don't want to automatically retrieve your location based on you IP address (for example if you use an VPN), you can configure the latitude and the longitude directly in the script by adding at the beginning of the script:\n\n```\nlat=48.8567  # Your latitude  \nlong=2.3508 # Your longitude\n```\n\n- If you don't want to use an argument as parameter for specifying the sunset or sunrise..., you can configure the event you want to wait directly in the script by adding at the beginning of the script:\n\n```\nsunset_or_sunrise='sunrise'# sunrise or sunset or solar_noon or civil_twilight_begin or civil_twilight_end or nautical_twilight_begin or nautical_twilight_end or astronomical_twilight_begin or astronomical_twilight_end\n```\nNow you will just need to execute `wait_until` without argument to directly wait for sunrise in this example\n\n## Examples\n\n- Wait for sunrise to run a script:\n\n```bash \nsleep_until sunrise \u0026\u0026 ./my_script.sh\n```\n\n- Wait for sunrise + 10 minutes (600 seconds) to run a script:\n\n```bash \nsleep_until sunrise \u0026\u0026 sleep 600 \u0026\u0026 ./my_script.sh\n```\n\n- Run script at dawn:\n\n```bash \nsleep_until civil_twilight_start \u0026\u0026 ./my_script.sh  \n```\n\n- Schedule at midnight, every day, a backup at solar noon with Crontab:\n\n```cron\n0 0 * * * sleep_until solar_noon \u0026\u0026 ./backup.sh\n```\n\n- Schedule at midnight, every day, a morning task at civil dawn with Crontab: \n\n```cron\n0 0 * * * sleep_until civil_twilight_begin \u0026\u0026 ~/morning_script.sh\n```\n\n- Suspend execution during the night:\n\n```bash\nwhile sleep_until sunrise; do\n  # Process to perform during day\ndone\n```\n\n- Close a Somfy shutter when the night is coming with the [tahoma program by pzim-devdata](https://github.com/pzim-devdata/tahoma):\n\n```bash\nsleep_until astronomical_twilight_start \u0026\u0026 tahoma close shutter ['shutter garden']\n```\n\n## Concrete case\n\nAn amateur astronomer wants to automate the taking of photos of stars at night. It uses sleep_until in its crontab to start its capture sequence only after astronomical dusk.\n\n## Copyright\n\ncopyright © 2024 pzim-devdata\n\nThis project is under the MIT License - see the LICENSE file for details.\n\n## Author\n\npzim-devdata\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzim-devdata%2Fsleep_until","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpzim-devdata%2Fsleep_until","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpzim-devdata%2Fsleep_until/lists"}