All Projects → buexplain → Go Watch

buexplain / Go Watch

监控你的程序文件变化并自动重启服务

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Go Watch

Cpx
A cli tool to watch and copy file globs.
Stars: ✭ 394 (+603.57%)
Mutual labels:  watch
Denon
👀 Monitor any changes in your Deno application and automatically restart.
Stars: ✭ 725 (+1194.64%)
Mutual labels:  watch
Proxy Watcher
A library that recursively watches an object for mutations via Proxies and tells you which paths changed.
Stars: ✭ 35 (-37.5%)
Mutual labels:  watch
30 Swift Projects In 30 Days
This is the demos to show 30 demos finishes in 30 days (or more)
Stars: ✭ 527 (+841.07%)
Mutual labels:  watch
Glow
Make your Flow errors GLOW
Stars: ✭ 707 (+1162.5%)
Mutual labels:  watch
Watchio
A programmable smart watch based on esp32-pico-d4
Stars: ✭ 25 (-55.36%)
Mutual labels:  watch
React Native Watch Connectivity
Enable communication between iWatch app and react native
Stars: ✭ 377 (+573.21%)
Mutual labels:  watch
Scroll Watcher
⚡️ 📜 A lightweight, blazing fast, rAF based, scroll watcher.
Stars: ✭ 51 (-8.93%)
Mutual labels:  watch
Diun
Receive notifications when an image is updated on a Docker registry
Stars: ✭ 704 (+1157.14%)
Mutual labels:  watch
Npm Build Boilerplate
A collection of packages that build a website using npm scripts.
Stars: ✭ 963 (+1619.64%)
Mutual labels:  watch
Invidious
Invidious is an alternative front-end to YouTube
Stars: ✭ 6,488 (+11485.71%)
Mutual labels:  watch
Arrive
Watch for DOM elements creation and removal
Stars: ✭ 703 (+1155.36%)
Mutual labels:  watch
Iobroker.vis Timeandweather
ioBroker Widgets set with time and weather
Stars: ✭ 12 (-78.57%)
Mutual labels:  watch
Termplay
GitLab: https://gitlab.com/jD91mZM2/termplay
Stars: ✭ 500 (+792.86%)
Mutual labels:  watch
Multitube
Watch multiple YouTube videos by providing video links or playlist links or channel links or maybe a mix of them! All without opening a single extra tab.
Stars: ✭ 36 (-35.71%)
Mutual labels:  watch
Tsc Watch
The TypeScript compiler with --watch and a new onSuccess argument
Stars: ✭ 391 (+598.21%)
Mutual labels:  watch
Rfdmovies Client
🎬instant recommending or finding or downloading movies via the command line
Stars: ✭ 18 (-67.86%)
Mutual labels:  watch
Saw
Fast, multi-purpose tool for AWS CloudWatch Logs
Stars: ✭ 1,071 (+1812.5%)
Mutual labels:  watch
Automod Bot
Fun moderation economy bot discord.js
Stars: ✭ 41 (-26.79%)
Mutual labels:  watch
Executor
Watch for file changes and then execute command. Very nice for test driven development.
Stars: ✭ 14 (-75%)
Mutual labels:  watch

监控你的程序文件变化并自动重启服务

docker 编译

docker create -it -e GOPROXY=https://goproxy.io --name myGolang -v /opt:/root/src -w /root/src golang bash
docker start myGolang
docker exec -it myGolang bash
git clone https://github.com/buexplain/go-watch.git
cd go-watch
CGO_ENABLED=0 go build -o gowatch main.go
  1. 编译时候必须设置环境变量GOPROXY=https://goproxy.io,避免下载golang的包被墙。
  2. 如果需要在docker中使用这个工具,则编译的时候必须设置CGO_ENABLED=0,否则编译后的包,不能在docker中使用。

使用说明

chmod u+x gowatch
./gowatch run -h
Usage:
   run [flags]

Flags:
      --args strings        启动命令所需参数
      --autoRestart         是否自动重启子进程,子进程非守护类型不建议自动重启
      --cmd string          启动命令
      --delay uint          命令延迟执行秒数 (default 2)
      --files strings       监视的文件
      --folder strings      监视的文件夹
  -h, --help                help for run
      --pattern string      监视文件变化的方式 poll 或 notify (default "poll")
      --preCmd string       预处理命令,启动命令执行前执行的命令
      --preCmdIgnoreError   是否忽略预处理命令的错误
      --preCmdTimeout int   预处理命令执行超时秒数 (default 10)
      --signal int          子进程关闭信号 (default 15)
      --timeout int         等待子进程关闭超时秒数 (default 5)
  1. 参数输入格式,请参阅cobra库。
  2. 如果操作系统不支持监视相关事件,或者是虚拟机与宿主机共享文件夹的情况下,那么只能使用 --pattern=poll 方式轮询监视文件。
  3. 参数--preCmd的值只支持用/bin/bash执行。
  4. 有时候预处理命令的结束code不是1,此时需要传递参数--preCmdIgnoreError=true

使用示例

以PHP类项目hyperf为例子,使用方式如下:

./gowatch run\
 --preCmd "php /hyperf-skeleton/bin/hyperf.php di:init-proxy"\
 --preCmdIgnoreError=true\
 --cmd "php"\
 --args "/hyperf-skeleton/bin/hyperf.php, start"\
 --files "/hyperf-skeleton/test/.env"\
 --folder "/hyperf-skeleton/app/, /hyperf-skeleton/config/"\
 --autoRestart=true

License

Apache-2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].