exec-hookd
To automate some of the deployment steps on my personal server, I needed a tool which can be triggered by a webhook and does execute some pre-defined commands.
A classic solution for this would be to have a simple PHP script with a call to system(...)
. But I don't have PHP installed on the server itself and wanted this to be more lightweight than a full Apache+PHP installation.
Thus exec-hookd was born. It is a small Go daemon which listens to HTTP POST requests and runs pre-defined commands when a matching path is requested.
Its configuration lives in a small JSON file, which lists the port to listen on and the paths together with their commands to execute:
{ "Port": 8059, "HookList": [ { "Path": "/myhook", "Exec": [ { "Cmd": "/usr/bin/somecmd", "Args": [ "--some", "arguments" ], "Timeout": "5s" } ] } ] }
The commands are called with a timeout after which they are stopped to avoid that things hang around forever.