{"id":16682398,"url":"https://github.com/sagikazarmark/fsig","last_synced_at":"2025-04-09T23:12:48.654Z","repository":{"id":57590592,"uuid":"124813759","full_name":"sagikazarmark/fsig","owner":"sagikazarmark","description":"Send signals to a subprocess when files change","archived":false,"fork":false,"pushed_at":"2018-09-25T11:40:24.000Z","size":55,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T23:12:41.983Z","etag":null,"topics":["signal","subprocess"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/sagikazarmark.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-03-12T00:43:24.000Z","updated_at":"2019-11-14T07:24:04.000Z","dependencies_parsed_at":"2022-09-13T12:41:26.989Z","dependency_job_id":null,"html_url":"https://github.com/sagikazarmark/fsig","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/sagikazarmark%2Ffsig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagikazarmark%2Ffsig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagikazarmark%2Ffsig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sagikazarmark%2Ffsig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sagikazarmark","download_url":"https://codeload.github.com/sagikazarmark/fsig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125589,"owners_count":21051770,"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":["signal","subprocess"],"created_at":"2024-10-12T14:07:26.285Z","updated_at":"2025-04-09T23:12:48.631Z","avatar_url":"https://github.com/sagikazarmark.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Signal (fsig)\n\n[![Build Status](https://img.shields.io/travis/sagikazarmark/fsig.svg?style=flat-square)](https://travis-ci.org/sagikazarmark/fsig)\n[![Go Report Card](https://goreportcard.com/badge/github.com/sagikazarmark/fsig?style=flat-square)](https://goreportcard.com/report/github.com/sagikazarmark/fsig)\n[![GoDoc](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/sagikazarmark/fsig)\n\n\n**Send signals to a child process upon file changes**\n\nThis project was born because of the need to reload applications upon Kubernetes ConfigMap changes,\nbut it can be used without the containerization stuff as well.\n\nFsig is heavily inspired by [configmap-reload](https://github.com/jimmidyson/configmap-reload)\nwhich provides a similar use case for modern application (like Prometheus) run on Kubernetes.\n\n\n## Usage\n\n```\nusage: fsig --watch=WATCH [\u003cflags\u003e] \u003csignal\u003e \u003ccmd\u003e [\u003cargs\u003e...]\n\nSend signals to a child process upon file changes\n\nFlags:\n      --help             Show context-sensitive help (also try --help-long and --help-man).\n  -w, --watch=WATCH ...  Watched directory (at least one)\n      --version          Show application version.\n\nArgs:\n  \u003csignal\u003e  Signal to be sent to the child process\n  \u003ccmd\u003e     Child process command\n  [\u003cargs\u003e]  Child process arguments\n```\n\n### Example\n\n```bash\n$ fsig -w watched/dir HUP -- ./my_program --arg\n```\n\n\n## Installation\n\nDownload a precompiled binary for the [latest](https://github.com/sagikazarmark/fsig/releases/latest) version.\n\n### Ubuntu images\n\n```dockerfile\nRUN apt-get update \u0026\u0026 apt-get install -y wget\n\nENV FSIG_VERSION 0.4.0\nRUN wget https://github.com/sagikazarmark/fsig/releases/download/v${FSIG_VERSION}/fsig_${FSIG_VERSION}_linux_amd64.tar.gz \\\n    \u0026\u0026 tar -C /usr/local/bin -xzvf fsig_${FSIG_VERSION}_linux_amd64.tar.gz fsig \\\n    \u0026\u0026 rm fsig_linux_amd64.tar.gz\n```\n\n### Alpine images\n\n```dockerfile\nRUN apk add --no-cache openssl\n\nENV FSIG_VERSION 0.4.0\nRUN wget https://github.com/sagikazarmark/fsig/releases/download/v${FSIG_VERSION}/fsig_${FSIG_VERSION}_linux_amd64.tar.gz \\\n    \u0026\u0026 tar -C /usr/local/bin -xzvf fsig_${FSIG_VERSION}_linux_amd64.tar.gz fsig \\\n    \u0026\u0026 rm fsig_linux_amd64.tar.gz\n```\n\n\n## Alternatives\n\nfsig might not always fit your use case.\nThe following alternatives provide similar solutions to the problem fsig tries to solve.\n\n\n### Shell script\n\n\n**Pros:**\n\n- very simple\n- has only two dependencies (`bash`, `inotifywait`)\n\n\n**Cons:**\n\n- works by putting processes in the background\n\n\n```bash\n#!/bin/bash\n\n{\n    echo \"Starting [APPLICATION]\"\n    start_application \"$@\"\n} \u0026\n\npid=$!\nwatches=${WATCH_PATHS:-\"/path/to/watched/file\"}\n\necho \"Setting up watches for ${watches[@]}\"\n\n{\n    inotifywait -e modify,move,create,delete --timefmt '%d/%m/%y %H:%M' -m --format '%T' ${watches[@]} | while read date time; do\n        echo \"File change detected at ${time} on ${date}\"\n        kill -s HUP $pid\n    done\n    \n    echo \"Watching file changes failed, killing application\"\n    kill -TERM $pid\n} \u0026\n\nwait $pid || exit 1\n```\n\n#### Install on Alpine\n\n```bash\n$ apk add bash inotify-tools\n```\n\n#### Install on Debian\n\n```bash\n$ apt-get install bash inotify-tools\n```\n\n\n### Entr\n\n[entr](http://entrproject.org/) is a tool similar to `inotifywait` with the purpose of providing better user\nexperience when used in scripts.\n\n**Pros:**\n\n- tiny dependency\n- very simple usage (compared to the script above)\n\n**Cons:**\n\n- cannot watch directories without exiting first which makes it impossible to use in a Docker container\n\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagikazarmark%2Ffsig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsagikazarmark%2Ffsig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsagikazarmark%2Ffsig/lists"}