From: cecilihf Date: Thu, 12 Jul 2007 10:20:33 +0000 (+0000) Subject: Added a new cli option, status, for checking the status of the varnish child process... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3599878ab096e606192132dbe21f489c56987a9c;p=varnish Added a new cli option, status, for checking the status of the varnish child process. This is for use in the webmin plugin. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1674 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index e6f66abe..71834c73 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -445,3 +445,13 @@ mcf_server_startstop(struct cli *cli, char **av, void *priv) cli_out(cli, "Child in state %s", ch_state[child_state]); } } + +/*--------------------------------------------------------------------*/ + +void +mcf_server_status(struct cli *cli, char **av, void *priv) +{ + (void)av; + (void)priv; + cli_out(cli, "Child is state %s", ch_state[child_state]); +} diff --git a/varnish-cache/bin/varnishd/mgt_cli.c b/varnish-cache/bin/varnishd/mgt_cli.c index d0a5b4af..232bc2ee 100644 --- a/varnish-cache/bin/varnishd/mgt_cli.c +++ b/varnish-cache/bin/varnishd/mgt_cli.c @@ -140,6 +140,7 @@ static struct cli_proto *cli_proto; /* XXX: what order should this list be in ? */ static struct cli_proto mgt_cli_proto[] = { { CLI_PING, cli_func_ping }, + { CLI_SERVER_STATUS, mcf_server_status, NULL }, { CLI_SERVER_START, mcf_server_startstop, NULL }, { CLI_SERVER_STOP, mcf_server_startstop, &cli_proto }, { CLI_STATS, mcf_stats, NULL }, diff --git a/varnish-cache/bin/varnishd/mgt_cli.h b/varnish-cache/bin/varnishd/mgt_cli.h index 884a776f..331598b1 100644 --- a/varnish-cache/bin/varnishd/mgt_cli.h +++ b/varnish-cache/bin/varnishd/mgt_cli.h @@ -31,6 +31,7 @@ /* mgt_child.c */ cli_func_t mcf_server_startstop; +cli_func_t mcf_server_status; /* mgt_param.c */ cli_func_t mcf_param_show; diff --git a/varnish-cache/bin/varnishd/varnishd.1 b/varnish-cache/bin/varnishd/varnishd.1 index e7d3eb86..ad226e27 100644 --- a/varnish-cache/bin/varnishd/varnishd.1 +++ b/varnish-cache/bin/varnishd/varnishd.1 @@ -316,6 +316,8 @@ All the numbers presented are totals since server startup; for a better idea of the current situation, use the .Xr varnishstat 1 utility. +.It Cm status +Check the status of the child process. .It Cm stop Stop the child process. .It Cm url.purge Ar regexp diff --git a/varnish-cache/include/cli.h b/varnish-cache/include/cli.h index 11013ec8..2852b208 100644 --- a/varnish-cache/include/cli.h +++ b/varnish-cache/include/cli.h @@ -211,6 +211,12 @@ "\tClose connection", \ 0, 0 +# define CLI_SERVER_STATUS \ + "status", \ + "status", \ + "\tCheck status of Varnish cache process.", \ + 0, 0 + /* * Status/return codes in the CLI protocol */