download-watch

command module
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

README

Jimdo / download-watch

download-watch is a utility to watch on URLs and save their output locally. Also it's possible to execute commands when files changed. For example you could reload a webserver when a new configuration was written.

It can save the file

  • periodically no matter what
  • when it changed (ETag aware) so that it's not written if the server says nothing changed
  • when the SHA256 hash doesn't match locally but on the server

Configuration file

---
# Optional: Command to use for executing the success_command, the command will get appended as one argument (default: ["/bin/bash", "-c"])
command_shell: ["/bin/bash", "-c"]
files:
  # Key for the map is the target file path
  /etc/myconfig.conf:
    # Optional: Specify user:pass for the basic authentication
    basic_auth: myuser:mypass
    # Optional: How long to wait for the file to finish downloading (default: 30s)
    timeout: 30s
    # Required: How long to wait between two downloads
    fetch_interval: 5m
    # Optional: Ignore ETag sent by server, refresh file even if it's the same
    ignore_etag: false
    # Optional: Check existing file / downloaded file against checksum
    sha256: e84712238709398f6d349dc2250b0efca4b72d8c2bfb7b74339d30ba94056b14
    # Required: URL to fetch the file from
    url: https://example.com/myconfig.conf
    # Optional: Command to execute every time the file was written successfully
    success_command: /etc/init.d/apache2 reload
  /etc/myotherconfig.conf:
    url: https://example.com/myotherconfig.conf
    fetch_interval: 1h

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL