Tools: setup-unit: added restart command.
It restarts all running unitd instances. This is useful when recompiling unitd often, so that the latest build is running, without having to manually kill unitd instances and re-run with the same exact command line every time. Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
This commit is contained in:
@@ -84,6 +84,7 @@ SYNOPSIS
|
|||||||
├── os-probe [-h]
|
├── os-probe [-h]
|
||||||
├── ps [-h] [-t TYPE]
|
├── ps [-h] [-t TYPE]
|
||||||
├── repo-config [-hn] [PKG-MANAGER OS-NAME OS-VERSION]
|
├── repo-config [-hn] [PKG-MANAGER OS-NAME OS-VERSION]
|
||||||
|
├── restart [-h]
|
||||||
├── sock [-h] SUBCOMMAND [ARGS]
|
├── sock [-h] SUBCOMMAND [ARGS]
|
||||||
│ ├── filter [-chs]
|
│ ├── filter [-chs]
|
||||||
│ └── find [-h]
|
│ └── find [-h]
|
||||||
@@ -1219,6 +1220,52 @@ __EOF__";
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
help_unit_restart()
|
||||||
|
{
|
||||||
|
cat <<__EOF__ ;
|
||||||
|
SYNOPSIS
|
||||||
|
$0 restart [-h]
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
Restart all running unitd(8) instances.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-h, --help
|
||||||
|
Print this help.
|
||||||
|
|
||||||
|
__EOF__
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unit_restart()
|
||||||
|
{
|
||||||
|
while test $# -ge 1; do
|
||||||
|
case "$1" in
|
||||||
|
-h | --help)
|
||||||
|
help_unit_restart;
|
||||||
|
exit 0;
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
err "restart: $1: Unknown option.";
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
err "restart: $1: Unknown argument.";
|
||||||
|
;;
|
||||||
|
esac;
|
||||||
|
shift;
|
||||||
|
done;
|
||||||
|
|
||||||
|
local cmds="$(unit_cmd)";
|
||||||
|
|
||||||
|
pkill -e unitd;
|
||||||
|
|
||||||
|
printf '%s\n' "$cmds" \
|
||||||
|
| while read -r cmd; do
|
||||||
|
eval $cmd;
|
||||||
|
done;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
help_unit_sock()
|
help_unit_sock()
|
||||||
{
|
{
|
||||||
cat <<__EOF__ ;
|
cat <<__EOF__ ;
|
||||||
@@ -1478,6 +1525,10 @@ repo-config)
|
|||||||
shift;
|
shift;
|
||||||
unit_repo_config $@;
|
unit_repo_config $@;
|
||||||
;;
|
;;
|
||||||
|
restart)
|
||||||
|
shift;
|
||||||
|
unit_restart $@;
|
||||||
|
;;
|
||||||
sock)
|
sock)
|
||||||
shift;
|
shift;
|
||||||
unit_sock $@;
|
unit_sock $@;
|
||||||
|
|||||||
Reference in New Issue
Block a user