Sign inSign up

doanthuanthanh88/watcher

By doanthuanthanh88

•Updated about 7 years ago

Watch files then execute script

Image
0

366

doanthuanthanh88/watcher repository overview

⁠docker-compose.yml


version: "3.6"
services:
  watcher:
    image: doanthuanthanh88/watcher
    container_name: watcher
    volumes:
      - ~/.ssh:/root/.ssh                                               # To call ssh to do something on docker host
      - ./watch.json:/usr/src/app/watch.json           # Config file
      - ./test:/watcher:ro                                             # This is folder which is watched the changes

⁠Config file description

  • ./watch.json: Config file
    • interval: Time to re-scan changes
    • dir: Folders which need to watch
    • ext: Extension which combine with dir to watch
    • exec: Do something when target is changed
      • file: File name which is changed
      • cmd: Do something here
      • delay: Delay time before execute cmd. If in this period time, there are so many call, it will wait to do the last

⁠config file "./watch.json"

{
  "interval": 1000, 
  "dir": [
    "/watcher"
  ],
  "ext": [
    ".evt"
  ],
  "exec": [
    {
      "file": "nginx.evt",
      "cmd": "echo \"thanh\"",
      "delay": 5000
    },
    {
      "file": "k.txt",
      "cmd": "echo 'thanh kklkk'"
    }
  ]
}

Tag summary

Content type

Image

Digest

Size

26.1 MB

Last updated

about 7 years ago

docker pull doanthuanthanh88/watcher