dengsgo / fileboy Goto Github PK
View Code? Open in Web Editor NEWfileboy,文件变更监听通知工具,使用 Go 编写。Fileboy, File Change Monitoring Notification Tool, written with Go.
Home Page: https://www.yoytang.com
License: MIT License
fileboy,文件变更监听通知工具,使用 Go 编写。Fileboy, File Change Monitoring Notification Tool, written with Go.
Home Page: https://www.yoytang.com
License: MIT License
問題1 : 我在Mac機的Terminal下 fileboy init
出了 command not found: fileboy
問題2 :
下载已经编译好的对应平台二进制文件,
重命名为fileboy,加入系统 Path 中即可。
系统 Path 是指那裡??
謝謝啊
能否支持以守护进程运行?开机自启动
希望执行的命令不要强制中断,并且希望加入初始化执行命令
你好,我这边遇到个情况,运行几天后就报这个错了
微软的绝对路径是 C:\a\b\c,D:\a\b\c。linux绝对路径是/a/b/c。
1,C:\ABC>>fileboy --filegirl C:/Datas/filegirl.yaml
结果路径变成:C:\ABC\C:/Datas/filegirl.yaml
2,程序启动目录不能指定,必须进到监听目录执行fileboy。
我把 fileboy 的執行檔和設定檔放在 /usr/local/bin/
想要持續監控 /etc
但是會出現
Dengsgo [[email protected]] Open Source with MIT License
[FileBoy]: 14:12:16 &{Core:{Version:1} Monitor:{Types:[.*] IncludeDirs:[/etc] ExceptDirs:[.idea .git .vscode node_modules vendor] Events:[write rename remove create chmod] TypesMap:map[.*:true] IncludeDirsMap:map[] ExceptDirsMap:map[] DirsMap:map[] IncludeDirsRec:map[]} Command:{Exec:[/usr/local/bin/watcher_notify.sh] DelayMillSecond:2000} Notifier:{CallUrl:} Instruction:[ignore-warn] InstructionMap:map[ignore-warn:true]}
[FileBoy]: 14:12:16 I: collecting directory information...
[FileBoy]: 14:12:16 O: dirs must be relative paths ! err path: /etc
所以我必須要把fileboy , filegirl.yaml 都丟到 /etc 底下,並加入--filegirl 的參數才能正確監控 /etc 目錄
請問有其他方式可以解決嗎?
默认的配置文件运行提示空间不足,是否可以获取debug信息?可以定位到问题吗 = =
Dengsgo [[email protected]] Open Source with MIT License
[FileBoy]: 14:13:09 &{Core:{Version:1} Monitor:{Types:[.go] IncludeDirs:[.] ExceptDirs:[.idea .git .vscode node_modules vendor] Events:[write rename remove create chmod] TypesMap:map[.go:true] IncludeDirsMap:map[] ExceptDirsMap:map[] DirsMap:map[] IncludeDirsRec:map[]} Command:{Exec:[ls {{file}}] DelayMillSecond:2000} Notifier:{CallUrl:} Instruction:[ignore-warn] InstructionMap:map[ignore-warn:true]}
[FileBoy]: 14:13:09 I: collecting directory information...
[FileBoy]: 14:13:09 I: watcher add -> /home/xu/tool
[FileBoy]: 14:13:09 O: no space left on device
df -h .
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 36G 16G 19G 46% /
cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
fileboy 版本
Version fileboy: v1.15 filegirl: v1
Released 2020.03.08
Licence MIT
Author dengsgo [[email protected]]
Website https://github.com/dengsgo/fileboy
Blog https://www.yoytang.com
go get: github.com/dengsgo/[email protected]: parsing go.mod:
module declares its path as: fileboy
but was required as: github.com/dengsgo/fileboy
比如:nginx -c 配置文件
场景:多配置启动。
当前:如果我要作用多配置启动,需要复制2个 fileboy进程和两个配置文件,放在不同位置,很是繁琐。
目前监听到一次目录变化并执行设定的命令后,后续对目录进行修改不会再触发设定命令,日志上显示也没有继续监听,是我设置的问题吗
环境:
Windows 7 SP1 专业版
filegirl 配置
command:exec:- cmd.exe /c echo {{file}} {{ext}} {{event}}
描述:
event create : "D:\test\1\新建文本文档.txt"
EXEC [cmd.exe /c echo 1 write]
正确情况应该显示:echo 1/新建文本文档.txt
复现过程:
打开 D:\test\1\
右键->新建->文本文档
D:\src\golang\src\tsl>fileboy -v
_______ _____ _ _______ ______ _____ _ _
(_______|_____) | (_______|____ \ / ___ \| | | |
_____ _ | | _____ ____) ) | | | |___| |
| ___) | | | | | ___) | __ (| | | |\_____/
| | _| |_| |_____| |_____| |__) ) |___| | ___
|_| (_____)_______)_______)______/ \_____/ (___) V1.6
This world is so lonely without you.
Dengsgo [[email protected]] Open Source with MIT License
Version fileboy: v1.6 filegirl: v1
Released 2019.1.19
Licence MIT
Author dengsgo [[email protected]]
Website https://github.com/dengsgo/fileboy
Blog https://www.yoytang.com
第一次测试
command:
exec:
- go fmt ./..
- go build -v -ldflags "-s -w -linkmode internal -extldflags \"-static\""
- tsl
[FileBoy]: 05:13:11 EVENT WRITE : D:\src\golang\src\tsl\modules\_blank\model\index.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x652a93]
goroutine 243 [running]:
os.(*ProcessState).exited(...)
C:/go/src/os/exec_posix.go:70
os.(*ProcessState).Exited(...)
C:/go/src/os/exec.go:146
main.(*TaskMan).preRun(0xc000065350, 0xc00033a630)
C:/goWork/src/fileboy/taskman.go:48 +0x43
main.(*TaskMan).Put.func1(0xc000065350, 0xc00033a630)
C:/goWork/src/fileboy/taskman.go:43 +0x7f
created by main.(*TaskMan).Put
C:/goWork/src/fileboy/taskman.go:38 +0xa3
换一下配置
command:
exec:
- go fmt {{file}}
- go build -v -ldflags "-s -w -linkmode internal -extldflags \"-static\""
- tsl
[FileBoy]: 05:14:52 fileboy is ready.
[FileBoy]: 05:14:55 EVENT RENAME : main.go
[FileBoy]: 05:14:57 Warn: notifier call url ignore.
[FileBoy]: 05:14:57 EXEC [go fmt main.go]
main.go
[FileBoy]: 05:14:58 EVENT WRITE : main.go
[FileBoy]: 05:14:58 EVENT WRITE : main.go
[FileBoy]: 05:14:58 EXEC [go build -v -ldflags "-s -w -linkmode internal -extldflags \"-static\""]
invalid value "\"-s" for flag -ldflags: missing =<value> in <pattern>=<value>
usage: go build [-o output] [-i] [build flags] [packages]
Run 'go help build' for details.
[FileBoy]: 05:14:58 Warn: cmd wait err exit status 2
[FileBoy]: 05:14:58 end
[FileBoy]: 05:15:00 Warn: notifier call url ignore.
[FileBoy]: 05:15:00 EXEC [go fmt main.go]
[FileBoy]: 05:15:01 EXEC [go build -v -ldflags "-s -w -linkmode internal -extldflags \"-static\""]
invalid value "\"-s" for flag -ldflags: missing =<value> in <pattern>=<value>
usage: go build [-o output] [-i] [build flags] [packages]
Run 'go help build' for details.
[FileBoy]: 05:15:01 Warn: cmd wait err exit status 2
[FileBoy]: 05:15:01 end
环境:Linux Manjaro64位
下载了 Linux
版本的可执行文件后,将文件所在目录添加至环境变量,执行 fileboy
时出现提示权限不够
$ fileboy init
zsh: 权限不够: fileboy
注意:标题字数有限无法说明详细内容
说明:
要是早点发现 fileboy就好(就不用重复造轮子),我用python写了类似的。
监控文件变更,然后执行定义的命令,文件变更后命令在60秒后才会执行,如果60秒内有新事件产生就重新开始计时。
使用场景:自动打包编译(文件夹更新后,自动 Inno setup Compile)
通知器,还没写,计划用微信推送,实现想法和你一样。
特殊指令没有想过要实现。
问题一:
通知器在什么时候会发送 http 请求 ?
是否支持,命令执行完成后,根据命令执行 exit code(非 fileboy) 通知结果。
问题二:
# should-finish (1)触发执行 'exec' 时(C),如果上一次的命令(L)未退出(还在执行),会等待 L 退出(而不是强制 kill ),直到 L 有明确 exit code 才会开始执行本次命令。
# (2)在等待 L 退出时,又有新事件触发了命令执行(N),则 C 执行取消,只会保留最后一次的 N 执行
(1)我明白,(2)这样的设计不是和(1)冲突吗?理由:(1)等待,(2)取消。
问题来了:should-finish 到底是等待还是取消?
问题三:
由于 fileboy 无法预估命令执行的时长,为防止执行中的命令一直阻塞,导致后续的命令任务响应滞后,现在采用的策略是有新任务进来就直接中断之前的任务(而不管它是否还在执行)。
中断之前的任务是 kill,还是忽略(看来是忽略)
问题四:
所有配置默认,除以下时间增加为10秒
delayMillSecond: 10000
需求:假设我有一个文件夹,里面有 A,B,C 三个文件夹,需要监控,并且通过 inno setup 进行打包成3个 setup.exe
1秒后,A文件夹更新,开始打包成 A_setup.exe
2秒后,B文件夹更新,开始打包成 B_setup.exe
3秒后,C文件夹更新,开始打包成 C_setup.exe
命令只会执行,开始打包成 C_setup.exe。A和B文件夹的更新会被忽略,没有打包。
解决思路:
golang 在1.11中移除了strings.ReplaceAll
希望能修复
来源
Hello, I currently only know python3+shell. How do the commands inside execute python commands? Is there a filegirl.yaml reference that can run through?
My python command is to generate a torrent of files larger than 100M in the folder and save it in another folder. And I found your command in the readme is golang.
文件夹删除没有事件通知
支持优雅的重启吗?
不停服务的重启 类似于nginx reload
这样
如题,所以修改输出的字符串好像没什么效果
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.