{"id":16627109,"url":"https://github.com/ttulka/process-watch-dog","last_synced_at":"2026-05-25T13:40:02.888Z","repository":{"id":57730158,"uuid":"106104831","full_name":"ttulka/process-watch-dog","owner":"ttulka","description":"Process Watch Dog Java Library","archived":false,"fork":false,"pushed_at":"2018-09-20T19:26:26.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-27T03:09:30.415Z","etag":null,"topics":["heartbeat","java","java-library","process","process-monitor","process-watch-dog","processes","watch"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ttulka.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":"2017-10-07T14:39:03.000Z","updated_at":"2018-09-20T19:26:27.000Z","dependencies_parsed_at":"2022-09-08T00:21:05.081Z","dependency_job_id":null,"html_url":"https://github.com/ttulka/process-watch-dog","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ttulka/process-watch-dog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fprocess-watch-dog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fprocess-watch-dog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fprocess-watch-dog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fprocess-watch-dog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ttulka","download_url":"https://codeload.github.com/ttulka/process-watch-dog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ttulka%2Fprocess-watch-dog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27763652,"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-12-16T02:00:10.477Z","response_time":57,"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":["heartbeat","java","java-library","process","process-monitor","process-watch-dog","processes","watch"],"created_at":"2024-10-12T04:13:25.492Z","updated_at":"2025-12-16T11:27:56.569Z","avatar_url":"https://github.com/ttulka.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Process Watch Dog\n\n**Java library for watching (and *killing*) processes.**\n\nWatch Dog thread runs only when there are same active processes to watch.\n\n```\n       .-------------.       .    .   *       *   \n      /_/_/_/_/_/_/_/ \\         *       .   )    .\n     //_/_/_/_/_/_// _ \\ __          .        .   \n    /_/_/_/_/_/_/_/|/ \\.' .`-o                    \n     |             ||-'(/ ,--'                    \n     |             ||  _ |                        \n     |             ||'' ||                        \n     |_____________|| |_|L                     hjm\n```\n\n## Prerequisites\n- Java 6\n\n## Usage\n\nCopy the Maven dependency into your Maven project:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecz.net21.ttulka.exec\u003c/groupId\u003e\n    \u003cartifactId\u003eprocess-watch-dog\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Watch a Process\n\n#### Create a Watch Dog object:\n```java\nProcessWatchDog watchDog = new ProcessWatchDog();\n```\n\n#### Create a process and watch it by the Watch Dog:\n```java\nProcessBuilder pb = new ProcessBuilder(\"myCommand\", \"myArg1\", \"myArg2\");\nProcess p = pb.start();\n\nwatchDog.watch(p, 1000); // kill the process after 1 sec\n```\n\n#### Watch another process by the same Watch Dog:\n```java\npb = new ProcessBuilder(\"otherCommand\");\nProcess p2 = pb.start();\n\nwatchDog.watch(p2, 2000); // kill the second process after 2 secs\n```\n\n### Unwatch a Process\n\n#### Unwatch a process if you don't care any longer:\n```java\nwatchDog.unwatch(p);\n```\n\n### Keep a Process Alive\nNormally, a process should be killed only after a timeout of inactivity. \nTo tell the Watch Dog that the process is still active a heartbeat must be sent. \n\n#### Send a heartbeat explicitly to reset the timeout:\n```java\nwatchDog.heartBeat(p);\n```\n\n#### Send a heartbeat automatically with every read byte:\n```java\np = watchDog.watch(p, 1000);    // reassign the `WatchedProcess` object to the process reference\n\nInputStream is = p.getInputStream();\nint b;\nwhile ((b = is.read()) != -1) {\n    // heartbeat is sent implicitly with every successful call of `read()` \n}\n``` \nAlternatively, send a heartbeat explicitly via `WatchedProcess` object:\n```java\nWatchedProcess wp = watchDog.watch(p, 1000);    // use the returned watched process object\nwp.heartBeat();\n```\n\n## Release Changes\n\n### 1.1.0\nWatched process with a heartbeat.\n\n- `WatchedProcess` class added.\n- `heartBeat(Process)` method added to the `ProcessWatchDog` class.\n\n### 1.0.0\nInitial version.\n\n## License\n\n[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttulka%2Fprocess-watch-dog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fttulka%2Fprocess-watch-dog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fttulka%2Fprocess-watch-dog/lists"}