{"id":13583163,"url":"https://github.com/terminalnetwork/syncthing-hooks","last_synced_at":"2025-04-06T18:31:55.662Z","repository":{"id":40931397,"uuid":"248073743","full_name":"terminalnetwork/syncthing-hooks","owner":"terminalnetwork","description":"Runs shell scripts when syncthing folders get updated. 🦉🕗","archived":false,"fork":false,"pushed_at":"2023-02-03T05:23:06.000Z","size":36,"stargazers_count":32,"open_issues_count":4,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-05T23:41:31.416Z","etag":null,"topics":["hooks","syncthing","watcher"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terminalnetwork.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}},"created_at":"2020-03-17T21:10:04.000Z","updated_at":"2024-10-20T18:56:15.000Z","dependencies_parsed_at":"2024-01-21T22:14:21.619Z","dependency_job_id":null,"html_url":"https://github.com/terminalnetwork/syncthing-hooks","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalnetwork%2Fsyncthing-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalnetwork%2Fsyncthing-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalnetwork%2Fsyncthing-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terminalnetwork%2Fsyncthing-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terminalnetwork","download_url":"https://codeload.github.com/terminalnetwork/syncthing-hooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247531063,"owners_count":20953885,"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":["hooks","syncthing","watcher"],"created_at":"2024-08-01T15:03:17.603Z","updated_at":"2025-04-06T18:31:55.399Z","avatar_url":"https://github.com/terminalnetwork.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# syncthing-hooks\n\nRun shell scripts via event hook files (similar to Git hooks) when changes are detected in a [Syncthing](https://syncthing.net/) folder.\n\n## Prerequisites\n\n[Node.js \u003e= 10](https://nodejs.org/en/)\n\n## Installation\n\n```sh\nnpm i -g syncthing-hooks\n```\n\n## Usage\n\nYou can simply run the watcher process via:\n\n```sh\nAPI_KEY=mykey syncthing-hooks\n```\n\nDon't forget to substitute `mykey` with your syncthing API key, which can be found in the settings in the GUI.\n\nIf Syncthing runs on another host or listens to a non-default port, you can specify an URL by using `ST_URL`.\nNote that this URL has to include the protocol, hostname, port and path, e.g.:\n\n```\nST_URL=http://\u003cip\u003e:8384/rest/events\n```\n\nIt won't install itself as a daemon by default, however. In order to run it as a service, it is recommended to install [pm2](https://pm2.keymetrics.io/):\n\n```sh\nnpm i -g pm2\n```\n\nYou can then register it as a daemon via:\n\n```sh\npm2 start \"API_KEY=mykey syncthing-hooks\" --name sthooks\n```\n\nTo create the daemon automatically on startup, consult [this documentation](https://pm2.keymetrics.io/docs/usage/startup/).\n\nYou can follow the output of your hooks by using:\n\n```sh\npm2 logs\n```\n\n## Hooks\n\nCreate a folder in your home directory called `.syncthing-hooks`.\nA different directory can be set using `ST_HOOK_ROOT`.\nEach hook is a file with the following naming scheme:\n\n`folder-name-delay`\n\nThe folder name is the 11 character unique string found in the syncthing GUI. The delay is a string (anything parseable by the [ms module](https://github.com/zeit/ms)) indicating the idle time after an event, so that hooks aren't executed multiple times on successive changes in a short interval.\n\nAn example: a script at the location `~/.syncthing-hooks/night-owlzz-5m` will be executed five minutes after the most recent event in the folder with the identifier `night-owlzz`.\n\nDon't forget to `chmod +x` the script.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminalnetwork%2Fsyncthing-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterminalnetwork%2Fsyncthing-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterminalnetwork%2Fsyncthing-hooks/lists"}