twang

Twangs a URL and executes a command if it is not available.

npm install twang
4 downloads in the last month

Twang for Node.js

Twang is a Node.js package that twangs (requests!) a URL at pre-defined intervals and then executes a command if it becomes unavailable. This can be useful when you want to monitor a web service and do something (like restart it) if it fails to respond.

Installation

To install, run:

''' npm install twang '''

The app requires a config file which includes what URL you wish to twang and the command that will be executed if this fails to respond. Sample configuration can be found in config.sample.json.

To start the app, run:

''' node app -config config.json '''

...where config.json is the name of your configuration file.

Configuration

  • interval: The interval (in milliseconds) at which the app will twang the URL.
  • url: The URL that will be twanged!
  • command: The command that will be executed if the request to the URL doesn't return a response. This should be something that is either in the current directory or on the path (eg. "ipconfig" on Windows).
npm loves you