Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
39741c03
Commit
39741c03
authored
Oct 09, 2017
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document `-x optstring` and `--optstring`
parent
1908ea23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
run_cli.rst
doc/sphinx/users-guide/run_cli.rst
+44
-0
No files found.
doc/sphinx/users-guide/run_cli.rst
View file @
39741c03
...
...
@@ -169,3 +169,47 @@ always need to start the child process explicitly.
Should the child process die, the master process will automatically
restart it, but you can disable that with the 'auto_restart' parameter.
The shell, the other CLI
------------------------
Besides accessing the CLI via its interface or via ``varnishadm`` there
is the matter of actually running the ``varnishd`` command line, usually
via a shell. See :ref:`run_security` for security concerns around the
``varnishd`` command line. See also :ref:`ref_syntax` about the CLI
syntax and quoting pitfalls when using ``varnishadm``.
The programs shipped with Varnish can expose their *optstring* in order
to help writing wrapper scripts, in particular to get an opportunity to
hook a task before a program daemonizes. With the exception of
``varnishtest`` and ``varnishadm``, you can write Shell wrappers for
``varnishd`` using the ``-x`` option and other programs using the
``--optstring`` long option.
This way, when writing a wrapper script you don't need to maintain the
*optstring* in sync when you only need a subset of the options, usually
``-n`` or ``-P``::
optstring=$(varnishd -x optstring)
while getopts "$optstring" opt
do
case $opt in
n)
# handle $OPTARG
;;
# handle other options
*)
# ignore unneeded options
;;
esac
done
varnishd "$@"
# do something with the options
You can for example write a wrapper script that blocks until the shared
memory is ready or when the child is started if you need that kind of
synchronization. You can also prevent ``varnishd`` from starting if the
``-S`` option is inadvertently set to not challenge access to the CLI.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment