{"id":19573924,"url":"https://github.com/hexresearch/watchdog","last_synced_at":"2026-05-16T05:42:03.321Z","repository":{"id":99627034,"uuid":"110552099","full_name":"hexresearch/watchdog","owner":"hexresearch","description":"Utility for PC auto-restart. The app listens for signals on given TCP port and if nothing comes for specified amount of time it executes reboot-command.","archived":false,"fork":false,"pushed_at":"2017-11-14T17:17:04.000Z","size":8,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-09T03:56:47.376Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexresearch.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,"publiccode":null,"codemeta":null}},"created_at":"2017-11-13T13:32:31.000Z","updated_at":"2017-11-13T13:36:24.000Z","dependencies_parsed_at":"2023-04-10T04:49:09.516Z","dependency_job_id":null,"html_url":"https://github.com/hexresearch/watchdog","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/hexresearch%2Fwatchdog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fwatchdog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fwatchdog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexresearch%2Fwatchdog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexresearch","download_url":"https://codeload.github.com/hexresearch/watchdog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240840106,"owners_count":19866168,"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-11-11T06:37:01.064Z","updated_at":"2026-05-16T05:42:03.272Z","avatar_url":"https://github.com/hexresearch.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# watchdog\n\nUtility for PC auto-restart. The app listens for UNIX signals or messages\non given TCP port and if nothing comes for specified amount of time\nit executes reboot-command.\n\nThe invocation:\n\n~~~\nwatchdog --conf config.yaml\n~~~\n\nExample of the typical config:\n\n~~~yaml\nserver:                                   # optional\n  host: \"localhost\"\n  port: 8080\nsignal: SIGUSR1                           # optional\nduration: 10 # seconds\nrebootCmd: \"echo REBOOT ME\"\nlastRebootTimeFilePath: \"reboot-log.txt\"  # optional\ndebugMode: true                           # optional (false by default)\n~~~\n\nThe app listens for packets on TCP-socked specified in field `server`.\nFor `duration` seconds it waits for the packets. If nothing happens\nit executes `rebootCmd`. Also app can wait for unix signal specified in\nthe field signal. Note that both fields `server` and `signal` are optional.\nIf we need signals we can activate only signal section.\nFor TCP-only usage just omit the `signal` field.\n\nOptionally we can specify file `lastRebootTimeFilePath` to log\nthe last rebootCmd invocation time. If `debugMode` is set then\nthe command is not performed immediately but delayed by 10 seconds so that\nuser has choice to abort the reboot with Ctrl+C.\n\n### Test scenario\n\nStart first terminal with example config:\n\n~~~\nwatchdog --conf config,yaml\n~~~\n\n**For TCP**:\n\nIt will not reboot while we invoke in the second terminal:\n\n~~~\necho 1 | netcat localhost 8080\n~~~\n\n\n**For UNIX signals**:\n\nIt will not reboot while we invoke in the second terminal:\n\n~~~\npkill --signal USR1 watchdog\n~~~\n\n\n### Example for systemd service script\n\nSupply needed path to app and config file and put this\nfile to `/etc/systemd/system/` to define systemd service.\n\n~~~\n# location: /etc/systemd/system/\n[Unit]\nDescription=Auto-restart utility\nAfter=multi-user.target\n\n[Service]\nType=notify\nExecStart=/path/to/watchdog --conf /path/to/config.yaml \u0026\n\n[Install]\nWantedBy=multi-user.target\n~~~","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexresearch%2Fwatchdog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexresearch%2Fwatchdog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexresearch%2Fwatchdog/lists"}