summaryrefslogtreecommitdiffhomepage
path: root/tools/unitc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-06-18tools/unitc: Redirect stderr for curl feature testLiam Crilly1-1/+1
[ Tweaked subject prefix - Andrew ] Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-06-12Tools: improved error handling for unitcLiam Crilly1-24/+52
This patch does a number of things to help when failing to apply a new configuration. * The error body from the Unit control API is displayed which can have useful troubleshooting information (when the version of curl supports it). * When using the EDIT option, the temporary file with unapplied changes is preserved so that the user can edit it again without losing their work. * Editing JavaScript modules no longer requires that module to have been enabled. * Failure to apply edited JavaScript modules now rolls-back to the previous configuration instead of deleting the module. Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-02-20Updated copyright notice.Andrei Zeliankou1-1/+1
2024-02-19Tools: disambiguate unitc control socket detectionLiam Crilly1-2/+2
Now that unitd has multiple --control* startup options, locating the address of the control socket requires additional precision. Signed-off-by: Liam Crilly <liam.crilly@nginx.com> Acked-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
2024-01-16White space formatting fixesAndrei Zeliankou1-2/+2
Closes: <https://github.com/nginx/unit/pull/1062>
2023-10-18Tools: unitc remote mode edit fix.Liam Crilly1-2/+2
Previously, the edit method created a temporary file that was then sent to curl(1) as --data-binary @filename.tmp. This did not work with remote instances because the temporary file is not on the remote host. The edit method now passes the configuration to curl(1) using stdin, the same way as for all other configuration changes.
2023-10-16Tools: unitc Docker mode.Liam Crilly1-17/+29
Introduces a new remote host scheme docker:// that specifies a local container ID. By default, the control socket is assumed to be in the default location, as per the Docker Official Images for Unit. If not, the path to the control socket can be appended to the container ID.
2023-10-10Tools: unitc YAML mode.Liam Crilly1-7/+51
Added --format option to manage configuration in other formats. Initially, YAML is the only supported conversion format. JSON/YAML conversion is performed with yq(1). Suggested by: Torstein Krause Johansen <https://github.com/skybert> Closes: #958 <https://github.com/nginx/unit/issues/958>
2023-10-03Tools: unitc quiet mode fix for macOS.Liam Crilly1-1/+1
head -c 0 does not work on macOS (invalid byte count) but tail(1) is happy to accept zero bytes, and does not have a performance penalty.
2023-06-07Tools: unitc edit mode for interactive configuration.Liam Crilly1-2/+26
2023-06-01Tools: improved ps(1) portability for unitc.Liam Crilly1-4/+19
Improved cross-platform support by trying multiple ps(1) invocations to obtain the unitd command line parameters. Additional error checking detects when this process fails. The first attempt uses `ps -wwo args=COMMAND -p` which has very broad support and has the additional benefit of simplifying the output for more reliable parsing of the process info. If that fails then we fall back to simply `ps`. The parsing of the process info has also changed. Instead of converting '[]' into spaces we now convert them into explicit delimiters (using '^'). This is more reliable as it marks the beginning and the end of the info we care about. Any trailing process information is now ignored (FreeBSD). Additional error handling improves the robustness when starting unitd with a different filename or from a relative path. In this case the control socket and log file detection will fail when running `unitd --help`. Additional error checking and messages are displayed when the control socket cannot be determined. A single warning is shown when the log file cannot be determined.
2023-05-24Updated copyright notice.Andrei Zeliankou1-1/+1
2023-04-04Tools: use control socket and log file from running instance.Liam Crilly1-2/+2
If unitd was started with an explicit path then unitc will use that binary instead of the default PATH to obtain the default control socket and log file locations.
2023-02-27Tools: improved detection of unitd control socket.Liam Crilly1-5/+5
Now unitc obtains the path to the unitd binary from information contained in the unitd: main process. If unitd was started with an explicit path then that path will be used to obtain the default control socket, instead of using the unitd binary in $PATH.
2022-12-19Tools: unitc avoid interactive rm(1) invocations.Liam Crilly1-3/+3
2022-12-14Tools: Added unitc.Liam Crilly1-0/+235