定制 hnhdigital-os/fs-watcher 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hnhdigital-os/fs-watcher

Composer 安装命令:

composer create-project hnhdigital-os/fs-watcher

包简介

Provides the ability to watch folders for changes and call a binary in response.

README 文档

README

Provides the ability to watch folders for changes and call a binary in response.

Latest Stable Version License: MIT Donate to this project using Patreon

This package has been developed by H&H|Digital, an Australian botique developer. Visit us at hnh.digital.

Requirements

  • PHP 7.3 (min)
  • php-inotify (pecl install inotify)

Installation

Download the latest build:

curl -o ./fs-watcher -LsS https://github.com/hnhdigital-os/fs-watcher/raw/master/builds/fs-watcher

chmod a+x ./fs-watcher

Move it local bin:

sudo mv ./fs-watcher /usr/local/bin/fs-watcher

Updating

This tool provides a self-update mechanism. Simply run the self-update command.

fs-watcher self-update

How to use

USAGE: fs-watcher <command> [options] [arguments]
  config           <set|get|reset> [key] [value]
                   Manage the configuration for this utility.

  self-update      Check if there is a new version and update.
  self-update      [--tag=?]
                   Update this binary to a specific tagged release.
  self-update      [--check-release=?]
                   Returns the current binary version.
  watch:now        [watch-path] [binary-path] [--script-arguments=""]
                   Specify the path to watch, when a file change is detected
                   this utility will call the specified binary at the path with the
                   specific script arguments.
  watch:background [watch-path] [binary-path] [--script-arguments=""]
                   Runs process in the background. Specify the path to watch,
                   when a file change is detected this utility will call the
                   specified binary at the path with the specific script arguments.
  watch:load       Load watchers from a config file.
  watch:list       List all current watchers.
  watch:kill       [pid]
                   Kill a specific process ID for a current watcher.
  watch:kill all   Kills all the watchers.
  watch:log        [pid]
                   View the current log for a specific process ID.
  watch:log        [--where]
                   Returns the path of the log files.
  watch:log        [pid] [--clear]
                   Clears the logs for a specific process ID.
  watch:log        [--clear]
                   Clears all the logs.

watch:now or watch:background

For example, if we want to watch for changes in the /some/folder/example path and have all changes notified to the executable file /some/bin/binary-file.

Note: This utility replaces the following placeholders {{root-path}}, {{file-path}} and {{event-id}} in the script-arguments argument with values. Both path arguments do not need quotations as they will be added automatically.

fs-watcher watch:background /some/folder/example /some/bin/binary-file --script-arguments="{{root-path}} {{file-path}} {{event-id}}"

On each file change in the given root folder, the following command execution will occur:

/some/bin/binary-file "/some/folder/example" "/some/folder/example/new-file" 256

watch:load

Instead of calling this utility for each folder you want to watch, you can use the watch:load command to load a YAML config file.

This config file is in the format:

WATCH-PATH:
 - BINARY-PATH: SCRIPT-ARGUMENTS

Example:

/some/folder/example:
 - /some/bin/binary-file: {{root-path}} {{file-path}} {{event-id}}

And then run this to load and start the watcher:

fs-watcher watch:load example.yml

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固