Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.
/ wanted Public archive

Run panic tasks on signal or broadcast receive.

License

Notifications You must be signed in to change notification settings

x13a/wanted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wanted

Run panic tasks on signal or broadcast receive.

Listen for signals:

  • USR1 to increment counter
  • USR2 to decrement counter

When counter equals threshold, run "arm" goroutine which waits for delay, if while delay counter become below threshold stop "arm" goroutine, else do clean and exit.

Broadcast receiver doesn't use counter.

Clean order:

  • Async (Broadcast, Run, Request, Mail)
  • Kill
  • Remove
  • Run

Async tasks has timeout, default to 16s, and run concurrently.

Installation

$ make
$ sudo make install

Usage

Usage of wanted:
  -V	Print version and exit
  -c value
    	Path to configuration file (default: /usr/local/etc/wanted.json)
  -m	Monitor mode (default: signal)
  -p string
    	Write pid to file

Example

To run with custom config filepath as signal receiver:

$ wanted -c ~/wanted.json

To run with default config filepath as broadcast receiver:

$ wanted -m broadcast

About

Run panic tasks on signal or broadcast receive.

Topics

Resources

License

Security policy

Stars

Watchers

Forks