{"id":13839746,"url":"https://github.com/adafruit/Adafruit-GPIO-Halt","last_synced_at":"2025-07-11T06:31:31.785Z","repository":{"id":46432037,"uuid":"22551074","full_name":"adafruit/Adafruit-GPIO-Halt","owner":"adafruit","description":"Press-to-halt program for headless Raspberry Pi. Similar functionality to the rpi_power_switch kernel module from the fbtft project, but easier to compile (no kernel headers needed).","archived":false,"fork":false,"pushed_at":"2021-10-13T15:25:26.000Z","size":20,"stargazers_count":60,"open_issues_count":1,"forks_count":15,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-05T03:11:05.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adafruit.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}},"created_at":"2014-08-02T16:52:22.000Z","updated_at":"2023-01-23T10:29:22.000Z","dependencies_parsed_at":"2022-09-04T01:22:12.637Z","dependency_job_id":null,"html_url":"https://github.com/adafruit/Adafruit-GPIO-Halt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit-GPIO-Halt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit-GPIO-Halt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit-GPIO-Halt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adafruit%2FAdafruit-GPIO-Halt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adafruit","download_url":"https://codeload.github.com/adafruit/Adafruit-GPIO-Halt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225676692,"owners_count":17506580,"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","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":[],"created_at":"2024-08-04T17:00:34.149Z","updated_at":"2024-11-21T08:31:30.925Z","avatar_url":"https://github.com/adafruit.png","language":"C","funding_links":[],"categories":["C","C (286)"],"sub_categories":[],"readme":"Adafruit-GPIO-Halt\n==================\n\nPress-to-halt program for headless Raspberry Pi. Similar functionality to the rpi_power_switch kernel module from the fbtft project, but easier to compile (no kernel headers needed).\n\n# Modifications\n- Added a second argument, the time (in milliseconds) that the button should be kept pressed for halt to start.\nFirst argument, which was present in the original, is the GPIO pin (21 by default).\n- `Make install` will copy the executable to /usr/local/sbin (instead of /usr/local/bin) and set root as the owner. This makes more sense as power handling commands are usually owned by root and located in sbin directories.\n\n## Install as a service \n(Based on this blog post: https://www.recantha.co.uk/blog/?p=13999)\n\nCreate and open service file:\n```\nsudo vi /etc/systemd/system/gpio-halt.service\n```\nAdd this content to the file:\n```\n[Unit]\nDescription=GPIO shutdown (pin 21 to ground)\nAfter=multi-user.target\n\n[Service]\nType=idle\nExecStart=/usr/local/sbin/gpio-halt 21 3000\n\n[Install]\nWantedBy=multi-user.target\n```\nStart the script:\n```\nsudo systemctl daemon-reload\nsudo systemctl start gpio-halt.service\n```\nMake the service run every time the system boots:\n```\nsudo systemctl enable gpio-halt.service\n```\nIf you want to check the status of the service:\n```\nsudo systemctl status gpio-halt.service\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2FAdafruit-GPIO-Halt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadafruit%2FAdafruit-GPIO-Halt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadafruit%2FAdafruit-GPIO-Halt/lists"}