.env.example | ||
.gitignore | ||
build.sh | ||
go.mod | ||
go.sum | ||
main.go | ||
README.md | ||
urlstocmd.example.json | ||
urltocmd.service |
URL to CMD app
A tiny web server that runs a specific command on the server when a specific URL is reached. A use case can be to update production code on a server, but without giving arbitrary command access to the server to external parties.
Dependencies and installation
To build a new binary, you need to have Go 1.21 or later installed and then run ./build.sh
. All binaries lands in the bin
folder.
To "install" this app, simply copy the binary to a folder in your $path, or run it directly.
There is no dependencies except for a supported architecture for the binary. If your architecture is not present, please add it and make a PR.
Running and configuration
Either copy .env.example
to .env
and modify the settings to your likings, or modify the ENV in your shell according to .env.example
. Modify urlstocmd.example.json
to your liking and rename it to match your ENV URLS_CMDS_JSON_PATH
. Then run the application.
Installing as a system.d service in compatible Linux systems (Debian etc)
- Configure the app according to the above instructions somewhere on your filesystem.
- Copy
urltocmd.service
to/etc/systemd/system/urltocmd.service
. - Modify
/etc/systemd/system/urltocmd.service
to match your needs (especially check User, ExecStart and WorkingDirectory) sudo systemctl daemon-reload && sudo systemctl enable urltocmd && sudo service urltocmd start
- Profit!
You can watch the log from urltocmd like this: sudo journalctl -u urltocmd -f
.
See more information about how to work with system.d services here.