configuration.rst 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479
  1. Configuration File
  2. ==================
  3. The Supervisor configuration file is conventionally named
  4. :file:`supervisord.conf`. It is used by both :program:`supervisord`
  5. and :program:`supervisorctl`. If either application is started
  6. without the ``-c`` option (the option which is used to tell the
  7. application the configuration filename explicitly), the application
  8. will look for a file named :file:`supervisord.conf` within the
  9. following locations, in the specified order. It will use the first
  10. file it finds.
  11. #. :file:`$CWD/supervisord.conf`
  12. #. :file:`$CWD/etc/supervisord.conf`
  13. #. :file:`/etc/supervisord.conf`
  14. :file:`supervisord.conf` is a Windows-INI-style (Python ConfigParser)
  15. file. It has sections (each denoted by a ``[header]``) and key / value
  16. pairs within the sections. The sections and their allowable values
  17. are described below.
  18. .. note::
  19. Some distributions have packaged Supervisor with their own
  20. customizations. These modified versions of Supervisor may load the
  21. configuration file from locations other than those described here.
  22. Notably, Ubuntu packages have been found that use
  23. ``/etc/supervisor/supervisord.conf``.
  24. ``[unix_http_server]`` Section Settings
  25. ---------------------------------------
  26. The :file:`supervisord.conf` file contains a section named
  27. ``[unix_http_server]`` under which configuration parameters for an
  28. HTTP server that listens on a UNIX domain socket should be inserted.
  29. If the configuration file has no ``[unix_http_server]`` section, a
  30. UNIX domain socket HTTP server will not be started. The allowable
  31. configuration values are as follows.
  32. ``[unix_http_server]`` Section Values
  33. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. ``file``
  35. A path to a UNIX domain socket (e.g. :file:`/tmp/supervisord.sock`)
  36. on which supervisor will listen for HTTP/XML-RPC requests.
  37. :program:`supervisorctl` uses XML-RPC to communicate with
  38. :program:`supervisord` over this port. This option can include the
  39. value ``%(here)s``, which expands to the directory in which the
  40. :program:`supervisord` configuration file was found.
  41. *Default*: None.
  42. *Required*: No.
  43. *Introduced*: 3.0
  44. ``chmod``
  45. Change the UNIX permission mode bits of the UNIX domain socket to
  46. this value at startup.
  47. *Default*: ``0700``
  48. *Required*: No.
  49. *Introduced*: 3.0
  50. ``chown``
  51. Change the user and group of the socket file to this value. May be
  52. a UNIX username (e.g. ``chrism``) or a UNIX username and group
  53. separated by a colon (e.g. ``chrism:wheel``).
  54. *Default*: Use the username and group of the user who starts supervisord.
  55. *Required*: No.
  56. *Introduced*: 3.0
  57. ``username``
  58. The username required for authentication to this HTTP server.
  59. *Default*: No username required.
  60. *Required*: No.
  61. *Introduced*: 3.0
  62. ``password``
  63. The password required for authentication to this HTTP server. This
  64. can be a cleartext password, or can be specified as a SHA-1 hash if
  65. prefixed by the string ``{SHA}``. For example,
  66. ``{SHA}82ab876d1387bfafe46cc1c8a2ef074eae50cb1d`` is the SHA-stored
  67. version of the password "thepassword".
  68. Note that hashed password must be in hex format.
  69. *Default*: No password required.
  70. *Required*: No.
  71. *Introduced*: 3.0
  72. ``[unix_http_server]`` Section Example
  73. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74. .. code-block:: ini
  75. [unix_http_server]
  76. file = /tmp/supervisor.sock
  77. chmod = 0777
  78. chown= nobody:nogroup
  79. username = user
  80. password = 123
  81. ``[inet_http_server]`` Section Settings
  82. ---------------------------------------
  83. The :file:`supervisord.conf` file contains a section named
  84. ``[inet_http_server]`` under which configuration parameters for an
  85. HTTP server that listens on a TCP (internet) socket should be
  86. inserted. If the configuration file has no ``[inet_http_server]``
  87. section, an inet HTTP server will not be started. The allowable
  88. configuration values are as follows.
  89. ``[inet_http_server]`` Section Values
  90. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  91. ``port``
  92. A TCP host:port value or (e.g. ``127.0.0.1:9001``) on which
  93. supervisor will listen for HTTP/XML-RPC requests.
  94. :program:`supervisorctl` will use XML-RPC to communicate with
  95. :program:`supervisord` over this port. To listen on all interfaces
  96. in the machine, use ``:9001`` or ``*:9001``.
  97. *Default*: No default.
  98. *Required*: Yes.
  99. *Introduced*: 3.0
  100. ``username``
  101. The username required for authentication to this HTTP server.
  102. *Default*: No username required.
  103. *Required*: No.
  104. *Introduced*: 3.0
  105. ``password``
  106. The password required for authentication to this HTTP server. This
  107. can be a cleartext password, or can be specified as a SHA-1 hash if
  108. prefixed by the string ``{SHA}``. For example,
  109. ``{SHA}82ab876d1387bfafe46cc1c8a2ef074eae50cb1d`` is the SHA-stored
  110. version of the password "thepassword".
  111. Note that hashed password must be in hex format.
  112. *Default*: No password required.
  113. *Required*: No.
  114. *Introduced*: 3.0
  115. ``[inet_http_server]`` Section Example
  116. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  117. .. code-block:: ini
  118. [inet_http_server]
  119. port = 127.0.0.1:9001
  120. username = user
  121. password = 123
  122. ``[supervisord]`` Section Settings
  123. ----------------------------------
  124. The :file:`supervisord.conf` file contains a section named
  125. ``[supervisord]`` in which global settings related to the
  126. :program:`supervisord` process should be inserted. These are as
  127. follows.
  128. ``[supervisord]`` Section Values
  129. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. ``logfile``
  131. The path to the activity log of the supervisord process. This
  132. option can include the value ``%(here)s``, which expands to the
  133. directory in which the supervisord configuration file was found.
  134. *Default*: :file:`$CWD/supervisord.log`
  135. *Required*: No.
  136. *Introduced*: 3.0
  137. ``logfile_maxbytes``
  138. The maximum number of bytes that may be consumed by the activity log
  139. file before it is rotated (suffix multipliers like "KB", "MB", and
  140. "GB" can be used in the value). Set this value to 0 to indicate an
  141. unlimited log size.
  142. *Default*: 50MB
  143. *Required*: No.
  144. *Introduced*: 3.0
  145. ``logfile_backups``
  146. The number of backups to keep around resulting from activity log
  147. file rotation. If set to 0, no backups will be kept.
  148. *Default*: 10
  149. *Required*: No.
  150. *Introduced*: 3.0
  151. ``loglevel``
  152. The logging level, dictating what is written to the supervisord
  153. activity log. One of ``critical``, ``error``, ``warn``, ``info``,
  154. ``debug``, ``trace``, or ``blather``. Note that at log level
  155. ``debug``, the supervisord log file will record the stderr/stdout
  156. output of its child processes and extended info info about process
  157. state changes, which is useful for debugging a process which isn't
  158. starting properly. See also: :ref:`activity_log_levels`.
  159. *Default*: info
  160. *Required*: No.
  161. *Introduced*: 3.0
  162. ``pidfile``
  163. The location in which supervisord keeps its pid file. This option
  164. can include the value ``%(here)s``, which expands to the directory
  165. in which the supervisord configuration file was found.
  166. *Default*: :file:`$CWD/supervisord.pid`
  167. *Required*: No.
  168. *Introduced*: 3.0
  169. ``umask``
  170. The :term:`umask` of the supervisord process.
  171. *Default*: ``022``
  172. *Required*: No.
  173. *Introduced*: 3.0
  174. ``nodaemon``
  175. If true, supervisord will start in the foreground instead of
  176. daemonizing.
  177. *Default*: false
  178. *Required*: No.
  179. *Introduced*: 3.0
  180. ``minfds``
  181. The minimum number of file descriptors that must be available before
  182. supervisord will start successfully. A call to setrlimit will be made
  183. to attempt to raise the soft and hard limits of the supervisord process to
  184. satisfy ``minfds``. The hard limit may only be raised if supervisord
  185. is run as root. supervisord uses file descriptors liberally, and will
  186. enter a failure mode when one cannot be obtained from the OS, so it's
  187. useful to be able to specify a minimum value to ensure it doesn't run out
  188. of them during execution. This option is particularly useful on Solaris,
  189. which has a low per-process fd limit by default.
  190. *Default*: 1024
  191. *Required*: No.
  192. *Introduced*: 3.0
  193. ``minprocs``
  194. The minimum number of process descriptors that must be available
  195. before supervisord will start successfully. A call to setrlimit will be
  196. made to attempt to raise the soft and hard limits of the supervisord process
  197. to satisfy ``minprocs``. The hard limit may only be raised if supervisord
  198. is run as root. supervisord will enter a failure mode when the OS runs out
  199. of process descriptors, so it's useful to ensure that enough process
  200. descriptors are available upon :program:`supervisord` startup.
  201. *Default*: 200
  202. *Required*: No.
  203. *Introduced*: 3.0
  204. ``nocleanup``
  205. Prevent supervisord from clearing any existing ``AUTO``
  206. chlild log files at startup time. Useful for debugging.
  207. *Default*: false
  208. *Required*: No.
  209. *Introduced*: 3.0
  210. ``childlogdir``
  211. The directory used for ``AUTO`` child log files. This option can
  212. include the value ``%(here)s``, which expands to the directory in
  213. which the :program:`supervisord` configuration file was found.
  214. *Default*: value of Python's :func:`tempfile.get_tempdir`
  215. *Required*: No.
  216. *Introduced*: 3.0
  217. ``user``
  218. If :program:`supervisord` is run as the root user, switch users to
  219. this UNIX user account before doing any meaningful processing. This
  220. value has no effect if :program:`supervisord` is not run as root.
  221. *Default*: do not switch users
  222. *Required*: No.
  223. *Introduced*: 3.0
  224. ``directory``
  225. When :program:`supervisord` daemonizes, switch to this directory.
  226. This option can include the value ``%(here)s``, which expands to the
  227. directory in which the :program:`supervisord` configuration file was
  228. found.
  229. *Default*: do not cd
  230. *Required*: No.
  231. *Introduced*: 3.0
  232. ``strip_ansi``
  233. Strip all ANSI escape sequences from child log files.
  234. *Default*: false
  235. *Required*: No.
  236. *Introduced*: 3.0
  237. ``environment``
  238. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  239. will be placed in the :program:`supervisord` process' environment
  240. (and as a result in all of its child process' environments). This
  241. option can include the value ``%(here)s``, which expands to the
  242. directory in which the supervisord configuration file was found.
  243. Values containing non-alphanumeric characters should be quoted
  244. (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise, quoting the
  245. values is optional but recommended. To escape percent characters,
  246. simply use two. (e.g. ``URI="/first%%20name"``) **Note** that
  247. subprocesses will inherit the environment variables of the shell
  248. used to start :program:`supervisord` except for the ones overridden
  249. here and within the program's ``environment`` option. See
  250. :ref:`subprocess_environment`.
  251. *Default*: no values
  252. *Required*: No.
  253. *Introduced*: 3.0
  254. ``identifier``
  255. The identifier string for this supervisor process, used by the RPC
  256. interface.
  257. *Default*: supervisor
  258. *Required*: No.
  259. *Introduced*: 3.0
  260. ``[supervisord]`` Section Example
  261. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  262. .. code-block:: ini
  263. [supervisord]
  264. logfile = /tmp/supervisord.log
  265. logfile_maxbytes = 50MB
  266. logfile_backups=10
  267. loglevel = info
  268. pidfile = /tmp/supervisord.pid
  269. nodaemon = false
  270. minfds = 1024
  271. minprocs = 200
  272. umask = 022
  273. user = chrism
  274. identifier = supervisor
  275. directory = /tmp
  276. nocleanup = true
  277. childlogdir = /tmp
  278. strip_ansi = false
  279. environment = KEY1="value1",KEY2="value2"
  280. ``[supervisorctl]`` Section Settings
  281. ------------------------------------
  282. The configuration file may contain settings for the
  283. :program:`supervisorctl` interactive shell program. These options
  284. are listed below.
  285. ``[supervisorctl]`` Section Values
  286. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287. ``serverurl``
  288. The URL that should be used to access the supervisord server,
  289. e.g. ``http://localhost:9001``. For UNIX domain sockets, use
  290. ``unix:///absolute/path/to/file.sock``.
  291. *Default*: ``http://localhost:9001``
  292. *Required*: No.
  293. *Introduced*: 3.0
  294. ``username``
  295. The username to pass to the supervisord server for use in
  296. authentication. This should be same as ``username`` from the
  297. supervisord server configuration for the port or UNIX domain socket
  298. you're attempting to access.
  299. *Default*: No username
  300. *Required*: No.
  301. *Introduced*: 3.0
  302. ``password``
  303. The password to pass to the supervisord server for use in
  304. authentication. This should be the cleartext version of ``password``
  305. from the supervisord server configuration for the port or UNIX
  306. domain socket you're attempting to access. This value cannot be
  307. passed as a SHA hash. Unlike other passwords specified in this
  308. file, it must be provided in cleartext.
  309. *Default*: No password
  310. *Required*: No.
  311. *Introduced*: 3.0
  312. ``prompt``
  313. String used as supervisorctl prompt.
  314. *Default*: ``supervisor``
  315. *Required*: No.
  316. *Introduced*: 3.0
  317. ``history_file``
  318. A path to use as the ``readline`` persistent history file. If you
  319. enable this feature by choosing a path, your supervisorctl commands
  320. will be kept in the file, and you can use readline (e.g. arrow-up)
  321. to invoke commands you performed in your last supervisorctl session.
  322. *Default*: No file
  323. *Required*: No.
  324. *Introduced*: 3.0a5
  325. ``[supervisorctl]`` Section Example
  326. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  327. .. code-block:: ini
  328. [supervisorctl]
  329. serverurl = unix:///tmp/supervisor.sock
  330. username = chris
  331. password = 123
  332. prompt = mysupervisor
  333. .. _programx_section:
  334. ``[program:x]`` Section Settings
  335. --------------------------------
  336. The configuration file must contain one or more ``program`` sections
  337. in order for supervisord to know which programs it should start and
  338. control. The header value is composite value. It is the word
  339. "program", followed directly by a colon, then the program name. A
  340. header value of ``[program:foo]`` describes a program with the name of
  341. "foo". The name is used within client applications that control the
  342. processes that are created as a result of this configuration. It is
  343. an error to create a ``program`` section that does not have a name.
  344. The name must not include a colon character or a bracket character.
  345. The value of the name is used as the value for the
  346. ``%(program_name)s`` string expression expansion within other values
  347. where specified.
  348. .. note::
  349. A ``[program:x]`` section actually represents a "homogeneous
  350. process group" to supervisor (as of 3.0). The members of the group
  351. are defined by the combination of the ``numprocs`` and
  352. ``process_name`` parameters in the configuration. By default, if
  353. numprocs and process_name are left unchanged from their defaults,
  354. the group represented by ``[program:x]`` will be named ``x`` and
  355. will have a single process named ``x`` in it. This provides a
  356. modicum of backwards compatibility with older supervisor releases,
  357. which did not treat program sections as homogeneous process group
  358. definitions.
  359. But for instance, if you have a ``[program:foo]`` section with a
  360. ``numprocs`` of 3 and a ``process_name`` expression of
  361. ``%(program_name)s_%(process_num)02d``, the "foo" group will
  362. contain three processes, named ``foo_00``, ``foo_01``, and
  363. ``foo_02``. This makes it possible to start a number of very
  364. similar processes using a single ``[program:x]`` section. All
  365. logfile names, all environment strings, and the command of programs
  366. can also contain similar Python string expressions, to pass
  367. slightly different parameters to each process.
  368. ``[program:x]`` Section Values
  369. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  370. ``command``
  371. The command that will be run when this program is started. The
  372. command can be either absolute (e.g. ``/path/to/programname``) or
  373. relative (e.g. ``programname``). If it is relative, the
  374. supervisord's environment ``$PATH`` will be searched for the
  375. executable. Programs can accept arguments, e.g. ``/path/to/program
  376. foo bar``. The command line can use double quotes to group
  377. arguments with spaces in them to pass to the program,
  378. e.g. ``/path/to/program/name -p "foo bar"``. Note that the value of
  379. ``command`` may include Python string expressions,
  380. e.g. ``/path/to/programname --port=80%(process_num)02d`` might
  381. expand to ``/path/to/programname --port=8000`` at runtime. String
  382. expressions are evaluated against a dictionary containing the keys
  383. ``group_name``, ``host_node_name``, ``process_num``, ``program_name``,
  384. ``here`` (the directory of the supervisord config file), and all
  385. supervisord's environment variables prefixed with ``ENV_``. Controlled
  386. programs should themselves not be daemons, as supervisord assumes it is
  387. responsible for daemonizing its subprocesses (see
  388. :ref:`nondaemonizing_of_subprocesses`).
  389. *Default*: No default.
  390. *Required*: Yes.
  391. *Introduced*: 3.0
  392. ``process_name``
  393. A Python string expression that is used to compose the supervisor
  394. process name for this process. You usually don't need to worry
  395. about setting this unless you change ``numprocs``. The string
  396. expression is evaluated against a dictionary that includes
  397. ``group_name``, ``host_node_name``, ``process_num``, ``program_name``,
  398. and ``here`` (the directory of the supervisord config file).
  399. *Default*: ``%(program_name)s``
  400. *Required*: No.
  401. *Introduced*: 3.0
  402. ``numprocs``
  403. Supervisor will start as many instances of this program as named by
  404. numprocs. Note that if numprocs > 1, the ``process_name``
  405. expression must include ``%(process_num)s`` (or any other
  406. valid Python string expression that includes ``process_num``) within
  407. it.
  408. *Default*: 1
  409. *Required*: No.
  410. *Introduced*: 3.0
  411. ``numprocs_start``
  412. An integer offset that is used to compute the number at which
  413. ``numprocs`` starts.
  414. *Default*: 0
  415. *Required*: No.
  416. *Introduced*: 3.0
  417. ``priority``
  418. The relative priority of the program in the start and shutdown
  419. ordering. Lower priorities indicate programs that start first and
  420. shut down last at startup and when aggregate commands are used in
  421. various clients (e.g. "start all"/"stop all"). Higher priorities
  422. indicate programs that start last and shut down first.
  423. *Default*: 999
  424. *Required*: No.
  425. *Introduced*: 3.0
  426. ``autostart``
  427. If true, this program will start automatically when supervisord is
  428. started.
  429. *Default*: true
  430. *Required*: No.
  431. *Introduced*: 3.0
  432. ``autorestart``
  433. May be one of ``false``, ``unexpected``, or ``true``. If ``false``,
  434. the process will never be autorestarted. If ``unexpected``, the
  435. process will be restart when the program exits with an exit code
  436. that is not one of the exit codes associated with this process'
  437. configuration (see ``exitcodes``). If ``true``, the process will be
  438. unconditionally restarted when it exits, without regard to its exit
  439. code.
  440. *Default*: unexpected
  441. *Required*: No.
  442. *Introduced*: 3.0
  443. ``startsecs``
  444. The total number of seconds which the program needs to stay running
  445. after a startup to consider the start successful. If the program
  446. does not stay up for this many seconds after it has started, even if
  447. it exits with an "expected" exit code (see ``exitcodes``), the
  448. startup will be considered a failure. Set to ``0`` to indicate that
  449. the program needn't stay running for any particular amount of time.
  450. *Default*: 1
  451. *Required*: No.
  452. *Introduced*: 3.0
  453. ``startretries``
  454. The number of serial failure attempts that :program:`supervisord`
  455. will allow when attempting to start the program before giving up and
  456. puting the process into an ``FATAL`` state. See
  457. :ref:`process_states` for explanation of the ``FATAL`` state.
  458. *Default*: 3
  459. *Required*: No.
  460. *Introduced*: 3.0
  461. ``exitcodes``
  462. The list of "expected" exit codes for this program. If the
  463. ``autorestart`` parameter is set to ``unexpected``, and the process
  464. exits in any other way than as a result of a supervisor stop
  465. request, :program:`supervisord` will restart the process if it exits
  466. with an exit code that is not defined in this list.
  467. *Default*: 0,2
  468. *Required*: No.
  469. *Introduced*: 3.0
  470. ``stopsignal``
  471. The signal used to kill the program when a stop is requested. This
  472. can be any of TERM, HUP, INT, QUIT, KILL, USR1, or USR2.
  473. *Default*: TERM
  474. *Required*: No.
  475. *Introduced*: 3.0
  476. ``stopwaitsecs``
  477. The number of seconds to wait for the OS to return a SIGCHILD to
  478. :program:`supervisord` after the program has been sent a stopsignal.
  479. If this number of seconds elapses before :program:`supervisord`
  480. receives a SIGCHILD from the process, :program:`supervisord` will
  481. attempt to kill it with a final SIGKILL.
  482. *Default*: 10
  483. *Required*: No.
  484. *Introduced*: 3.0
  485. ``stopasgroup``
  486. If true, the flag causes supervisor to send the stop signal to the
  487. whole process group and implies ``killasgroup`` is true. This is useful
  488. for programs, such as Flask in debug mode, that do not propagate
  489. stop signals to their children, leaving them orphaned.
  490. *Default*: false
  491. *Required*: No.
  492. *Introduced*: 3.0b1
  493. ``killasgroup``
  494. If true, when resorting to send SIGKILL to the program to terminate
  495. it send it to its whole process group instead, taking care of its
  496. children as well, useful e.g with Python programs using
  497. :mod:`multiprocessing`.
  498. *Default*: false
  499. *Required*: No.
  500. *Introduced*: 3.0a11
  501. ``user``
  502. If :program:`supervisord` runs as root, this UNIX user account will
  503. be used as the account which runs the program. If :program:`supervisord`
  504. can't switch to the specified user, the program will not be started.
  505. .. note::
  506. The user will be changed using ``setuid`` only. This does not start
  507. a login shell and does not change environment variables like
  508. ``USER`` or ``HOME``. See :ref:`subprocess_environment` for details.
  509. *Default*: Do not switch users
  510. *Required*: No.
  511. *Introduced*: 3.0
  512. ``redirect_stderr``
  513. If true, cause the process' stderr output to be sent back to
  514. :program:`supervisord` on its stdout file descriptor (in UNIX shell
  515. terms, this is the equivalent of executing ``/the/program 2>&1``).
  516. .. note::
  517. Do not set ``redirect_stderr=true`` in an ``[eventlistener:x]`` section.
  518. Eventlisteners use ``stdout`` and ``stdin`` to communicate with
  519. ``supervisord``. If ``stderr`` is redirected, output from
  520. ``stderr`` will interfere with the eventlistener protocol.
  521. *Default*: false
  522. *Required*: No.
  523. *Introduced*: 3.0, replaces 2.0's ``log_stdout`` and ``log_stderr``
  524. ``stdout_logfile``
  525. Put process stdout output in this file (and if redirect_stderr is
  526. true, also place stderr output in this file). If ``stdout_logfile``
  527. is unset or set to ``AUTO``, supervisor will automatically choose a
  528. file location. If this is set to ``NONE``, supervisord will create
  529. no log file. ``AUTO`` log files and their backups will be deleted
  530. when :program:`supervisord` restarts. The ``stdout_logfile`` value
  531. can contain Python string expressions that will evaluated against a
  532. dictionary that contains the keys ``group_name``, ``host_node_name``,
  533. ``process_num``, ``program_name``, and ``here`` (the directory of the
  534. supervisord config file).
  535. .. note::
  536. It is not possible for two processes to share a single log file
  537. (``stdout_logfile``) when rotation (``stdout_logfile_maxbytes``)
  538. is enabled. This will result in the file being corrupted.
  539. *Default*: ``AUTO``
  540. *Required*: No.
  541. *Introduced*: 3.0, replaces 2.0's ``logfile``
  542. ``stdout_logfile_maxbytes``
  543. The maximum number of bytes that may be consumed by
  544. ``stdout_logfile`` before it is rotated (suffix multipliers like
  545. "KB", "MB", and "GB" can be used in the value). Set this value to 0
  546. to indicate an unlimited log size.
  547. *Default*: 50MB
  548. *Required*: No.
  549. *Introduced*: 3.0, replaces 2.0's ``logfile_maxbytes``
  550. ``stdout_logfile_backups``
  551. The number of ``stdout_logfile`` backups to keep around resulting
  552. from process stdout log file rotation. If set to 0, no backups
  553. will be kept.
  554. *Default*: 10
  555. *Required*: No.
  556. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  557. ``stdout_capture_maxbytes``
  558. Max number of bytes written to capture FIFO when process is in
  559. "stdout capture mode" (see :ref:`capture_mode`). Should be an
  560. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  561. value). If this value is 0, process capture mode will be off.
  562. *Default*: 0
  563. *Required*: No.
  564. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  565. ``stdout_events_enabled``
  566. If true, PROCESS_LOG_STDOUT events will be emitted when the process
  567. writes to its stdout file descriptor. The events will only be
  568. emitted if the file descriptor is not in capture mode at the time
  569. the data is received (see :ref:`capture_mode`).
  570. *Default*: 0
  571. *Required*: No.
  572. *Introduced*: 3.0a7
  573. ``stderr_logfile``
  574. Put process stderr output in this file unless ``redirect_stderr`` is
  575. true. Accepts the same value types as ``stdout_logfile`` and may
  576. contain the same Python string expressions.
  577. .. note::
  578. It is not possible for two processes to share a single log file
  579. (``stderr_logfile``) when rotation (``stderr_logfile_maxbytes``)
  580. is enabled. This will result in the file being corrupted.
  581. *Default*: ``AUTO``
  582. *Required*: No.
  583. *Introduced*: 3.0
  584. ``stderr_logfile_maxbytes``
  585. The maximum number of bytes before logfile rotation for
  586. ``stderr_logfile``. Accepts the same value types as
  587. ``stdout_logfile_maxbytes``.
  588. *Default*: 50MB
  589. *Required*: No.
  590. *Introduced*: 3.0
  591. ``stderr_logfile_backups``
  592. The number of backups to keep around resulting from process stderr
  593. log file rotation. If set to 0, no backups will be kept.
  594. *Default*: 10
  595. *Required*: No.
  596. *Introduced*: 3.0
  597. ``stderr_capture_maxbytes``
  598. Max number of bytes written to capture FIFO when process is in
  599. "stderr capture mode" (see :ref:`capture_mode`). Should be an
  600. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  601. value). If this value is 0, process capture mode will be off.
  602. *Default*: 0
  603. *Required*: No.
  604. *Introduced*: 3.0
  605. ``stderr_events_enabled``
  606. If true, PROCESS_LOG_STDERR events will be emitted when the process
  607. writes to its stderr file descriptor. The events will only be
  608. emitted if the file descriptor is not in capture mode at the time
  609. the data is received (see :ref:`capture_mode`).
  610. *Default*: false
  611. *Required*: No.
  612. *Introduced*: 3.0a7
  613. ``environment``
  614. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  615. will be placed in the child process' environment. The environment
  616. string may contain Python string expressions that will be evaluated
  617. against a dictionary containing ``group_name``, ``host_node_name``,
  618. ``process_num``, ``program_name``, and ``here`` (the directory of the
  619. supervisord config file). Values containing non-alphanumeric characters
  620. should be quoted (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise,
  621. quoting the values is optional but recommended. **Note** that the
  622. subprocess will inherit the environment variables of the shell used to
  623. start "supervisord" except for the ones overridden here. See
  624. :ref:`subprocess_environment`.
  625. *Default*: No extra environment
  626. *Required*: No.
  627. *Introduced*: 3.0
  628. ``directory``
  629. A file path representing a directory to which :program:`supervisord`
  630. should temporarily chdir before exec'ing the child.
  631. *Default*: No chdir (inherit supervisor's)
  632. *Required*: No.
  633. *Introduced*: 3.0
  634. ``umask``
  635. An octal number (e.g. 002, 022) representing the umask of the
  636. process.
  637. *Default*: No special umask (inherit supervisor's)
  638. *Required*: No.
  639. *Introduced*: 3.0
  640. ``serverurl``
  641. The URL passed in the environment to the subprocess process as
  642. ``SUPERVISOR_SERVER_URL`` (see :mod:`supervisor.childutils`) to
  643. allow the subprocess to easily communicate with the internal HTTP
  644. server. If provided, it should have the same syntax and structure
  645. as the ``[supervisorctl]`` section option of the same name. If this
  646. is set to AUTO, or is unset, supervisor will automatically construct
  647. a server URL, giving preference to a server that listens on UNIX
  648. domain sockets over one that listens on an internet socket.
  649. *Default*: AUTO
  650. *Required*: No.
  651. *Introduced*: 3.0
  652. ``[program:x]`` Section Example
  653. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  654. .. code-block:: ini
  655. [program:cat]
  656. command=/bin/cat
  657. process_name=%(program_name)s
  658. numprocs=1
  659. directory=/tmp
  660. umask=022
  661. priority=999
  662. autostart=true
  663. autorestart=true
  664. startsecs=10
  665. startretries=3
  666. exitcodes=0,2
  667. stopsignal=TERM
  668. stopwaitsecs=10
  669. user=chrism
  670. redirect_stderr=false
  671. stdout_logfile=/a/path
  672. stdout_logfile_maxbytes=1MB
  673. stdout_logfile_backups=10
  674. stdout_capture_maxbytes=1MB
  675. stderr_logfile=/a/path
  676. stderr_logfile_maxbytes=1MB
  677. stderr_logfile_backups=10
  678. stderr_capture_maxbytes=1MB
  679. environment=A="1",B="2"
  680. serverurl=AUTO
  681. ``[include]`` Section Settings
  682. ------------------------------
  683. The :file:`supervisord.conf` file may contain a section named
  684. ``[include]``. If the configuration file contains an ``[include]``
  685. section, it must contain a single key named "files". The values in
  686. this key specify other configuration files to be included within the
  687. configuration.
  688. ``[include]`` Section Values
  689. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  690. ``files``
  691. A space-separated sequence of file globs. Each file glob may be
  692. absolute or relative. If the file glob is relative, it is
  693. considered relative to the location of the configuration file which
  694. includes it. A "glob" is a file pattern which matches a specified
  695. pattern according to the rules used by the Unix shell. No tilde
  696. expansion is done, but ``*``, ``?``, and character ranges expressed
  697. with ``[]`` will be correctly matched. Recursive includes from
  698. included files are not supported.
  699. *Default*: No default (required)
  700. *Required*: Yes.
  701. *Introduced*: 3.0
  702. ``[include]`` Section Example
  703. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  704. .. code-block:: ini
  705. [include]
  706. files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf
  707. ``[group:x]`` Section Settings
  708. ------------------------------
  709. It is often useful to group "homogeneous" process groups (aka
  710. "programs") together into a "heterogeneous" process group so they can
  711. be controlled as a unit from Supervisor's various controller
  712. interfaces.
  713. To place programs into a group so you can treat them as a unit, define
  714. a ``[group:x]`` section in your configuration file. The group header
  715. value is a composite. It is the word "group", followed directly by a
  716. colon, then the group name. A header value of ``[group:foo]``
  717. describes a group with the name of "foo". The name is used within
  718. client applications that control the processes that are created as a
  719. result of this configuration. It is an error to create a ``group``
  720. section that does not have a name. The name must not include a colon
  721. character or a bracket character.
  722. For a ``[group:x]``, there must be one or more ``[program:x]``
  723. sections elsewhere in your configuration file, and the group must
  724. refer to them by name in the ``programs`` value.
  725. If "homogeneous" process groups (represented by program sections) are
  726. placed into a "heterogeneous" group via ``[group:x]`` section's
  727. ``programs`` line, the homogeneous groups that are implied by the
  728. program section will not exist at runtime in supervisor. Instead, all
  729. processes belonging to each of the homogeneous groups will be placed
  730. into the heterogeneous group. For example, given the following group
  731. configuration:
  732. .. code-block:: ini
  733. [group:foo]
  734. programs=bar,baz
  735. priority=999
  736. Given the above, at supervisord startup, the ``bar`` and ``baz``
  737. homogeneous groups will not exist, and the processes that would have
  738. been under them will now be moved into the ``foo`` group.
  739. ``[group:x]`` Section Values
  740. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  741. ``programs``
  742. A comma-separated list of program names. The programs which are
  743. listed become members of the group.
  744. *Default*: No default (required)
  745. *Required*: Yes.
  746. *Introduced*: 3.0
  747. ``priority``
  748. A priority number analogous to a ``[program:x]`` priority value
  749. assigned to the group.
  750. *Default*: 999
  751. *Required*: No.
  752. *Introduced*: 3.0
  753. ``[group:x]`` Section Example
  754. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  755. .. code-block:: ini
  756. [group:foo]
  757. programs=bar,baz
  758. priority=999
  759. ``[fcgi-program:x]`` Section Settings
  760. -------------------------------------
  761. Supervisor can manage groups of `FastCGI <http://www.fastcgi.com>`_
  762. processes that all listen on the same socket. Until now, deployment
  763. flexibility for FastCGI was limited. To get full process management,
  764. you could use mod_fastcgi under Apache but then you were stuck with
  765. Apache's inefficient concurrency model of one process or thread per
  766. connection. In addition to requiring more CPU and memory resources,
  767. the process/thread per connection model can be quickly saturated by a
  768. slow resource, preventing other resources from being served. In order
  769. to take advantage of newer event-driven web servers such as lighttpd
  770. or nginx which don't include a built-in process manager, you had to
  771. use scripts like cgi-fcgi or spawn-fcgi. These can be used in
  772. conjunction with a process manager such as supervisord or daemontools
  773. but require each FastCGI child process to bind to its own socket.
  774. The disadvantages of this are: unnecessarily complicated web server
  775. configuration, ungraceful restarts, and reduced fault tolerance. With
  776. fewer sockets to configure, web server configurations are much smaller
  777. if groups of FastCGI processes can share sockets. Shared sockets
  778. allow for graceful restarts because the socket remains bound by the
  779. parent process while any of the child processes are being restarted.
  780. Finally, shared sockets are more fault tolerant because if a given
  781. process fails, other processes can continue to serve inbound
  782. connections.
  783. With integrated FastCGI spawning support, Supervisor gives you the
  784. best of both worlds. You get full-featured process management with
  785. groups of FastCGI processes sharing sockets without being tied to a
  786. particular web server. It's a clean separation of concerns, allowing
  787. the web server and the process manager to each do what they do best.
  788. .. note::
  789. The socket manager in Supervisor was originally developed to support
  790. FastCGI processes but it is not limited to FastCGI. Other protocols may
  791. be used as well with no special configuration. Any program that can
  792. access an open socket from a file descriptor (e.g. with
  793. `socket.fromfd <http://docs.python.org/library/socket.html#socket.fromfd>`_
  794. in Python) can use the socket manager. Supervisor will automatically
  795. create the socket, bind, and listen before forking the first child in a
  796. group. The socket will be passed to each child on file descriptor
  797. number ``0`` (zero). When the last child in the group exits,
  798. Supervisor will close the socket.
  799. All the options available to ``[program:x]`` sections are
  800. also respected by ``fcgi-program`` sections.
  801. ``[fcgi-program:x]`` Section Values
  802. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  803. ``[fcgi-program:x]`` sections have a single key which ``[program:x]``
  804. sections do not have.
  805. ``socket``
  806. The FastCGI socket for this program, either TCP or UNIX domain
  807. socket. For TCP sockets, use this format: ``tcp://localhost:9002``.
  808. For UNIX domain sockets, use ``unix:///absolute/path/to/file.sock``.
  809. String expressions are evaluated against a dictionary containing the
  810. keys "program_name" and "here" (the directory of the supervisord
  811. config file).
  812. *Default*: No default.
  813. *Required*: Yes.
  814. *Introduced*: 3.0
  815. ``socket_owner``
  816. For UNIX domain sockets, this parameter can be used to specify the user
  817. and group for the FastCGI socket. May be a UNIX username (e.g. chrism)
  818. or a UNIX username and group separated by a colon (e.g. chrism:wheel).
  819. *Default*: Uses the user and group set for the fcgi-program
  820. *Required*: No.
  821. *Introduced*: 3.0
  822. ``socket_mode``
  823. For UNIX domain sockets, this parameter can be used to specify the
  824. permission mode.
  825. *Default*: 0700
  826. *Required*: No.
  827. *Introduced*: 3.0
  828. Consult :ref:`programx_section` for other allowable keys, delta the
  829. above constraints and additions.
  830. ``[fcgi-program:x]`` Section Example
  831. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  832. .. code-block:: ini
  833. [fcgi-program:fcgiprogramname]
  834. command=/usr/bin/example.fcgi
  835. socket=unix:///var/run/supervisor/%(program_name)s.sock
  836. process_name=%(program_name)s_%(process_num)02d
  837. numprocs=5
  838. priority=999
  839. autostart=true
  840. autorestart=unexpected
  841. startsecs=1
  842. startretries=3
  843. exitcodes=0,2
  844. stopsignal=QUIT
  845. stopwaitsecs=10
  846. user=chrism
  847. redirect_stderr=true
  848. stdout_logfile=/a/path
  849. stdout_logfile_maxbytes=1MB
  850. stdout_logfile_backups=10
  851. stderr_logfile=/a/path
  852. stderr_logfile_maxbytes=1MB
  853. stderr_logfile_backups
  854. environment=A="1",B="2"
  855. ``[eventlistener:x]`` Section Settings
  856. --------------------------------------
  857. Supervisor allows specialized homogeneous process groups ("event
  858. listener pools") to be defined within the configuration file. These
  859. pools contain processes that are meant to receive and respond to event
  860. notifications from supervisor's event system. See :ref:`events` for
  861. an explanation of how events work and how to implement programs that
  862. can be declared as event listeners.
  863. Note that all the options available to ``[program:x]`` sections are
  864. respected by eventlistener sections *except* for
  865. ``stdout_capture_maxbytes`` and ``stderr_capture_maxbytes`` (event
  866. listeners cannot emit process communication events, see
  867. :ref:`capture_mode`).
  868. ``[eventlistener:x]`` Section Values
  869. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  870. ``[eventlistener:x]`` sections have a few keys which ``[program:x]``
  871. sections do not have.
  872. ``buffer_size``
  873. The event listener pool's event queue buffer size. When a listener
  874. pool's event buffer is overflowed (as can happen when an event
  875. listener pool cannot keep up with all of the events sent to it), the
  876. oldest event in the buffer is discarded.
  877. ``events``
  878. A comma-separated list of event type names that this listener is
  879. "interested" in receiving notifications for (see
  880. :ref:`event_types` for a list of valid event type names).
  881. ``result_handler``
  882. A `pkg_resources entry point string
  883. <http://peak.telecommunity.com/DevCenter/PkgResources>`_ that
  884. resolves to a Python callable. The default value is
  885. ``supervisor.dispatchers:default_handler``. Specifying an alternate
  886. result handler is a very uncommon thing to need to do, and as a
  887. result, how to create one is not documented.
  888. Consult :ref:`programx_section` for other allowable keys, delta the
  889. above constraints and additions.
  890. ``[eventlistener:x]`` Section Example
  891. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  892. .. code-block:: ini
  893. [eventlistener:theeventlistenername]
  894. command=/bin/eventlistener
  895. process_name=%(program_name)s_%(process_num)02d
  896. numprocs=5
  897. events=PROCESS_STATE
  898. buffer_size=10
  899. priority=-1
  900. autostart=true
  901. autorestart=unexpected
  902. startsecs=1
  903. startretries=3
  904. exitcodes=0,2
  905. stopsignal=QUIT
  906. stopwaitsecs=10
  907. user=chrism
  908. redirect_stderr=false
  909. stdout_logfile=/a/path
  910. stdout_logfile_maxbytes=1MB
  911. stdout_logfile_backups=10
  912. stderr_logfile=/a/path
  913. stderr_logfile_maxbytes=1MB
  914. stderr_logfile_backups
  915. environment=A="1",B="2"
  916. ``[rpcinterface:x]`` Section Settings
  917. -------------------------------------
  918. Adding ``rpcinterface:x`` settings in the configuration file is only
  919. useful for people who wish to extend supervisor with additional custom
  920. behavior.
  921. In the sample config file, there is a section which is named
  922. ``[rpcinterface:supervisor]``. By default it looks like the
  923. following.
  924. .. code-block:: ini
  925. [rpcinterface:supervisor]
  926. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  927. The ``[rpcinterface:supervisor]`` section *must* remain in the
  928. configuration for the standard setup of supervisor to work properly.
  929. If you don't want supervisor to do anything it doesn't already do out
  930. of the box, this is all you need to know about this type of section.
  931. However, if you wish to add rpc interface namespaces in order to
  932. customize supervisor, you may add additional ``[rpcinterface:foo]``
  933. sections, where "foo" represents the namespace of the interface (from
  934. the web root), and the value named by
  935. ``supervisor.rpcinterface_factory`` is a factory callable which should
  936. have a function signature that accepts a single positional argument
  937. ``supervisord`` and as many keyword arguments as required to perform
  938. configuration. Any extra key/value pairs defined within the
  939. ``[rpcinterface:x]`` section will be passed as keyword arguments to
  940. the factory.
  941. Here's an example of a factory function, created in the
  942. ``__init__.py`` file of the Python package ``my.package``.
  943. .. code-block:: python
  944. from my.package.rpcinterface import AnotherRPCInterface
  945. def make_another_rpcinterface(supervisord, **config):
  946. retries = int(config.get('retries', 0))
  947. another_rpc_interface = AnotherRPCInterface(supervisord, retries)
  948. return another_rpc_interface
  949. And a section in the config file meant to configure it.
  950. .. code-block:: ini
  951. [rpcinterface:another]
  952. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  953. retries = 1
  954. ``[rpcinterface:x]`` Section Values
  955. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  956. ``supervisor.rpcinterface_factory``
  957. ``pkg_resources`` "entry point" dotted name to your RPC interface's
  958. factory function.
  959. *Default*: N/A
  960. *Required*: No.
  961. *Introduced*: 3.0
  962. ``[rpcinterface:x]`` Section Example
  963. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  964. .. code-block:: ini
  965. [rpcinterface:another]
  966. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  967. retries = 1
  968. Environment Variable Interpolation
  969. ----------------------------------
  970. There may be a time where it is necessary to avoid hardcoded values in your
  971. configuration file (such as paths, port numbers, username, etc). Some teams
  972. may also put their supervisord.conf files under source control but may want
  973. to avoid committing sensitive information into the repository.
  974. With this, **all** the environment variables inherited by the ``supervisord``
  975. process are available and can be interpolated / expanded in **any**
  976. configuration value, under **any** section.
  977. Your configuration values may contain Python expressions for expanding
  978. the environment variables using the ``ENV_`` prefix. The sample syntax is
  979. ``foo_key=%(ENV_FOO)s``, where the value of the environment variable ``FOO``
  980. will be assigned to the ``foo_key``. The string values of environment
  981. variables will be converted properly to their correct types.
  982. .. note::
  983. - some sections such as ``[program:x]`` have other extra expansion options.
  984. - environment variables in the configuration will be required, otherwise
  985. supervisord will refuse to start.
  986. - any changes to the variable requires a restart in the ``supervisord``
  987. daemon.
  988. An example configuration snippet with customizable values:
  989. .. code-block:: ini
  990. [supervisord]
  991. logfile = %(ENV_MYSUPERVISOR_BASEDIR)s/%(ENV_MYSUPERVISOR_LOGFILE)s
  992. logfile_maxbytes = %(ENV_MYSUPERVISOR_LOGFILE_MAXBYTES)s
  993. logfile_backups=10
  994. loglevel = info
  995. pidfile = %(ENV_MYSUPERVISOR_BASEDIR)s/supervisor.pid
  996. nodaemon = false
  997. minfds = 1024
  998. minprocs = 200
  999. umask = 022
  1000. user = %(ENV_USER)s
  1001. [program:cat]
  1002. command=/bin/cat -x -y --optz=%(ENV_CAT_OPTZ)s
  1003. process_name=%(program_name)s
  1004. numprocs=%(ENV_CAT_NUMPROCS)s
  1005. directory=%(ENV_CAT_DIR)s
  1006. umask=022
  1007. priority=999
  1008. autostart=true
  1009. autorestart=true
  1010. exitcodes=0,2
  1011. user=%(ENV_USER)s
  1012. redirect_stderr=false
  1013. stopwaitsecs=10
  1014. The above sample config will require the following environment variables to be set:
  1015. - ``MYSUPERVISOR_BASEDIR``
  1016. - ``MYSUPERVISOR_LOGFILE``
  1017. - ``MYSUPERVISOR_LOGFILE_MAXBYTES``
  1018. - ``USER``
  1019. - ``CAT_OPTZ``
  1020. - ``CAT_NUMPROCS``
  1021. - ``CAT_DIRECTORY``