configuration.rst 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  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*: post-3.0a4 (not including 3.0a4)
  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. *Default*: Do not switch users
  506. *Required*: No.
  507. *Introduced*: 3.0
  508. ``redirect_stderr``
  509. If true, cause the process' stderr output to be sent back to
  510. :program:`supervisord` on its stdout file descriptor (in UNIX shell
  511. terms, this is the equivalent of executing ``/the/program 2>&1``).
  512. *Default*: false
  513. *Required*: No.
  514. *Introduced*: 3.0, replaces 2.0's ``log_stdout`` and ``log_stderr``
  515. ``stdout_logfile``
  516. Put process stdout output in this file (and if redirect_stderr is
  517. true, also place stderr output in this file). If ``stdout_logfile``
  518. is unset or set to ``AUTO``, supervisor will automatically choose a
  519. file location. If this is set to ``NONE``, supervisord will create
  520. no log file. ``AUTO`` log files and their backups will be deleted
  521. when :program:`supervisord` restarts. The ``stdout_logfile`` value
  522. can contain Python string expressions that will evaluated against a
  523. dictionary that contains the keys ``group_name``, ``host_node_name``,
  524. ``process_num``, ``program_name``, and ``here`` (the directory of the
  525. supervisord config file).
  526. .. note::
  527. It is not possible for two processes to share a single log file
  528. (``stdout_logfile``) when rotation (``stdout_logfile_maxbytes``)
  529. is enabled. This will result in the file being corrupted.
  530. *Default*: ``AUTO``
  531. *Required*: No.
  532. *Introduced*: 3.0, replaces 2.0's ``logfile``
  533. ``stdout_logfile_maxbytes``
  534. The maximum number of bytes that may be consumed by
  535. ``stdout_logfile`` before it is rotated (suffix multipliers like
  536. "KB", "MB", and "GB" can be used in the value). Set this value to 0
  537. to indicate an unlimited log size.
  538. *Default*: 50MB
  539. *Required*: No.
  540. *Introduced*: 3.0, replaces 2.0's ``logfile_maxbytes``
  541. ``stdout_logfile_backups``
  542. The number of ``stdout_logfile`` backups to keep around resulting
  543. from process stdout log file rotation. If set to 0, no backups
  544. will be kept.
  545. *Default*: 10
  546. *Required*: No.
  547. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  548. ``stdout_capture_maxbytes``
  549. Max number of bytes written to capture FIFO when process is in
  550. "stdout capture mode" (see :ref:`capture_mode`). Should be an
  551. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  552. value). If this value is 0, process capture mode will be off.
  553. *Default*: 0
  554. *Required*: No.
  555. *Introduced*: 3.0, replaces 2.0's ``logfile_backups``
  556. ``stdout_events_enabled``
  557. If true, PROCESS_LOG_STDOUT events will be emitted when the process
  558. writes to its stdout file descriptor. The events will only be
  559. emitted if the file descriptor is not in capture mode at the time
  560. the data is received (see :ref:`capture_mode`).
  561. *Default*: 0
  562. *Required*: No.
  563. *Introduced*: 3.0a7
  564. ``stdout_syslog``
  565. If true, stdout will be directed to syslog along with the process name.
  566. *Default*: False
  567. *Required*: No.
  568. *Introduced*: 4.0.0
  569. ``stderr_logfile``
  570. Put process stderr output in this file unless ``redirect_stderr`` is
  571. true. Accepts the same value types as ``stdout_logfile`` and may
  572. contain the same Python string expressions.
  573. .. note::
  574. It is not possible for two processes to share a single log file
  575. (``stderr_logfile``) when rotation (``stderr_logfile_maxbytes``)
  576. is enabled. This will result in the file being corrupted.
  577. *Default*: ``AUTO``
  578. *Required*: No.
  579. *Introduced*: 3.0
  580. ``stderr_logfile_maxbytes``
  581. The maximum number of bytes before logfile rotation for
  582. ``stderr_logfile``. Accepts the same value types as
  583. ``stdout_logfile_maxbytes``.
  584. *Default*: 50MB
  585. *Required*: No.
  586. *Introduced*: 3.0
  587. ``stderr_logfile_backups``
  588. The number of backups to keep around resulting from process stderr
  589. log file rotation. If set to 0, no backups will be kept.
  590. *Default*: 10
  591. *Required*: No.
  592. *Introduced*: 3.0
  593. ``stderr_capture_maxbytes``
  594. Max number of bytes written to capture FIFO when process is in
  595. "stderr capture mode" (see :ref:`capture_mode`). Should be an
  596. integer (suffix multipliers like "KB", "MB" and "GB" can used in the
  597. value). If this value is 0, process capture mode will be off.
  598. *Default*: 0
  599. *Required*: No.
  600. *Introduced*: 3.0
  601. ``stderr_events_enabled``
  602. If true, PROCESS_LOG_STDERR events will be emitted when the process
  603. writes to its stderr file descriptor. The events will only be
  604. emitted if the file descriptor is not in capture mode at the time
  605. the data is received (see :ref:`capture_mode`).
  606. *Default*: false
  607. *Required*: No.
  608. *Introduced*: 3.0a7
  609. ``stderr_syslog``
  610. If true, stderr will be directed to syslog along with the process name.
  611. *Default*: False
  612. *Required*: No.
  613. *Introduced*: 4.0.0
  614. ``environment``
  615. A list of key/value pairs in the form ``KEY="val",KEY2="val2"`` that
  616. will be placed in the child process' environment. The environment
  617. string may contain Python string expressions that will be evaluated
  618. against a dictionary containing ``group_name``, ``host_node_name``,
  619. ``process_num``, ``program_name``, and ``here`` (the directory of the
  620. supervisord config file). Values containing non-alphanumeric characters
  621. should be quoted (e.g. ``KEY="val:123",KEY2="val,456"``). Otherwise,
  622. quoting the values is optional but recommended. **Note** that the
  623. subprocess will inherit the environment variables of the shell used to
  624. start "supervisord" except for the ones overridden here. See
  625. :ref:`subprocess_environment`.
  626. *Default*: No extra environment
  627. *Required*: No.
  628. *Introduced*: 3.0
  629. ``directory``
  630. A file path representing a directory to which :program:`supervisord`
  631. should temporarily chdir before exec'ing the child.
  632. *Default*: No chdir (inherit supervisor's)
  633. *Required*: No.
  634. *Introduced*: 3.0
  635. ``umask``
  636. An octal number (e.g. 002, 022) representing the umask of the
  637. process.
  638. *Default*: No special umask (inherit supervisor's)
  639. *Required*: No.
  640. *Introduced*: 3.0
  641. ``serverurl``
  642. The URL passed in the environment to the subprocess process as
  643. ``SUPERVISOR_SERVER_URL`` (see :mod:`supervisor.childutils`) to
  644. allow the subprocess to easily communicate with the internal HTTP
  645. server. If provided, it should have the same syntax and structure
  646. as the ``[supervisorctl]`` section option of the same name. If this
  647. is set to AUTO, or is unset, supervisor will automatically construct
  648. a server URL, giving preference to a server that listens on UNIX
  649. domain sockets over one that listens on an internet socket.
  650. *Default*: AUTO
  651. *Required*: No.
  652. *Introduced*: 3.0
  653. ``[program:x]`` Section Example
  654. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  655. .. code-block:: ini
  656. [program:cat]
  657. command=/bin/cat
  658. process_name=%(program_name)s
  659. numprocs=1
  660. directory=/tmp
  661. umask=022
  662. priority=999
  663. autostart=true
  664. autorestart=true
  665. startsecs=10
  666. startretries=3
  667. exitcodes=0,2
  668. stopsignal=TERM
  669. stopwaitsecs=10
  670. user=chrism
  671. redirect_stderr=false
  672. stdout_logfile=/a/path
  673. stdout_logfile_maxbytes=1MB
  674. stdout_logfile_backups=10
  675. stdout_capture_maxbytes=1MB
  676. stderr_logfile=/a/path
  677. stderr_logfile_maxbytes=1MB
  678. stderr_logfile_backups=10
  679. stderr_capture_maxbytes=1MB
  680. environment=A="1",B="2"
  681. serverurl=AUTO
  682. ``[include]`` Section Settings
  683. ------------------------------
  684. The :file:`supervisord.conf` file may contain a section named
  685. ``[include]``. If the configuration file contains an ``[include]``
  686. section, it must contain a single key named "files". The values in
  687. this key specify other configuration files to be included within the
  688. configuration.
  689. ``[include]`` Section Values
  690. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  691. ``files``
  692. A space-separated sequence of file globs. Each file glob may be
  693. absolute or relative. If the file glob is relative, it is
  694. considered relative to the location of the configuration file which
  695. includes it. A "glob" is a file pattern which matches a specified
  696. pattern according to the rules used by the Unix shell. No tilde
  697. expansion is done, but ``*``, ``?``, and character ranges expressed
  698. with ``[]`` will be correctly matched. Recursive includes from
  699. included files are not supported.
  700. *Default*: No default (required)
  701. *Required*: Yes.
  702. *Introduced*: 3.0
  703. ``[include]`` Section Example
  704. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  705. .. code-block:: ini
  706. [include]
  707. files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf
  708. ``[group:x]`` Section Settings
  709. ------------------------------
  710. It is often useful to group "homogeneous" process groups (aka
  711. "programs") together into a "heterogeneous" process group so they can
  712. be controlled as a unit from Supervisor's various controller
  713. interfaces.
  714. To place programs into a group so you can treat them as a unit, define
  715. a ``[group:x]`` section in your configuration file. The group header
  716. value is a composite. It is the word "group", followed directly by a
  717. colon, then the group name. A header value of ``[group:foo]``
  718. describes a group with the name of "foo". The name is used within
  719. client applications that control the processes that are created as a
  720. result of this configuration. It is an error to create a ``group``
  721. section that does not have a name. The name must not include a colon
  722. character or a bracket character.
  723. For a ``[group:x]``, there must be one or more ``[program:x]``
  724. sections elsewhere in your configuration file, and the group must
  725. refer to them by name in the ``programs`` value.
  726. If "homogeneous" process groups (represented by program sections) are
  727. placed into a "heterogeneous" group via ``[group:x]`` section's
  728. ``programs`` line, the homogeneous groups that are implied by the
  729. program section will not exist at runtime in supervisor. Instead, all
  730. processes belonging to each of the homogeneous groups will be placed
  731. into the heterogeneous group. For example, given the following group
  732. configuration:
  733. .. code-block:: ini
  734. [group:foo]
  735. programs=bar,baz
  736. priority=999
  737. Given the above, at supervisord startup, the ``bar`` and ``baz``
  738. homogeneous groups will not exist, and the processes that would have
  739. been under them will now be moved into the ``foo`` group.
  740. ``[group:x]`` Section Values
  741. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  742. ``programs``
  743. A comma-separated list of program names. The programs which are
  744. listed become members of the group.
  745. *Default*: No default (required)
  746. *Required*: Yes.
  747. *Introduced*: 3.0
  748. ``priority``
  749. A priority number analogous to a ``[program:x]`` priority value
  750. assigned to the group.
  751. *Default*: 999
  752. *Required*: No.
  753. *Introduced*: 3.0
  754. ``[group:x]`` Section Example
  755. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  756. .. code-block:: ini
  757. [group:foo]
  758. programs=bar,baz
  759. priority=999
  760. ``[fcgi-program:x]`` Section Settings
  761. -------------------------------------
  762. Supervisor can manage groups of `FastCGI <http://www.fastcgi.com>`_
  763. processes that all listen on the same socket. Until now, deployment
  764. flexibility for FastCGI was limited. To get full process management,
  765. you could use mod_fastcgi under Apache but then you were stuck with
  766. Apache's inefficient concurrency model of one process or thread per
  767. connection. In addition to requiring more CPU and memory resources,
  768. the process/thread per connection model can be quickly saturated by a
  769. slow resource, preventing other resources from being served. In order
  770. to take advantage of newer event-driven web servers such as lighttpd
  771. or nginx which don't include a built-in process manager, you had to
  772. use scripts like cgi-fcgi or spawn-fcgi. These can be used in
  773. conjunction with a process manager such as supervisord or daemontools
  774. but require each FastCGI child process to bind to its own socket.
  775. The disadvantages of this are: unnecessarily complicated web server
  776. configuration, ungraceful restarts, and reduced fault tolerance. With
  777. fewer sockets to configure, web server configurations are much smaller
  778. if groups of FastCGI processes can share sockets. Shared sockets
  779. allow for graceful restarts because the socket remains bound by the
  780. parent process while any of the child processes are being restarted.
  781. Finally, shared sockets are more fault tolerant because if a given
  782. process fails, other processes can continue to serve inbound
  783. connections.
  784. With integrated FastCGI spawning support, Supervisor gives you the
  785. best of both worlds. You get full-featured process management with
  786. groups of FastCGI processes sharing sockets without being tied to a
  787. particular web server. It's a clean separation of concerns, allowing
  788. the web server and the process manager to each do what they do best.
  789. .. note::
  790. The socket manager in Supervisor was originally developed to support
  791. FastCGI processes but it is not limited to FastCGI. Other protocols may
  792. be used as well with no special configuration. Any program that can
  793. access an open socket from a file descriptor (e.g. with
  794. `socket.fromfd <http://docs.python.org/library/socket.html#socket.fromfd>`_
  795. in Python) can use the socket manager. Supervisor will automatically
  796. create the socket, bind, and listen before forking the first child in a
  797. group. The socket will be passed to each child on file descriptor
  798. number ``0`` (zero). When the last child in the group exits,
  799. Supervisor will close the socket.
  800. All the options available to ``[program:x]`` sections are
  801. also respected by ``fcgi-program`` sections.
  802. ``[fcgi-program:x]`` Section Values
  803. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  804. ``[fcgi-program:x]`` sections have a single key which ``[program:x]``
  805. sections do not have.
  806. ``socket``
  807. The FastCGI socket for this program, either TCP or UNIX domain
  808. socket. For TCP sockets, use this format: ``tcp://localhost:9002``.
  809. For UNIX domain sockets, use ``unix:///absolute/path/to/file.sock``.
  810. String expressions are evaluated against a dictionary containing the
  811. keys "program_name" and "here" (the directory of the supervisord
  812. config file).
  813. *Default*: No default.
  814. *Required*: Yes.
  815. *Introduced*: 3.0
  816. ``socket_owner``
  817. For UNIX domain sockets, this parameter can be used to specify the user
  818. and group for the FastCGI socket. May be a UNIX username (e.g. chrism)
  819. or a UNIX username and group separated by a colon (e.g. chrism:wheel).
  820. *Default*: Uses the user and group set for the fcgi-program
  821. *Required*: No.
  822. *Introduced*: 3.0
  823. ``socket_mode``
  824. For UNIX domain sockets, this parameter can be used to specify the
  825. permission mode.
  826. *Default*: 0700
  827. *Required*: No.
  828. *Introduced*: 3.0
  829. Consult :ref:`programx_section` for other allowable keys, delta the
  830. above constraints and additions.
  831. ``[fcgi-program:x]`` Section Example
  832. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  833. .. code-block:: ini
  834. [fcgi-program:fcgiprogramname]
  835. command=/usr/bin/example.fcgi
  836. socket=unix:///var/run/supervisor/%(program_name)s.sock
  837. process_name=%(program_name)s_%(process_num)02d
  838. numprocs=5
  839. priority=999
  840. autostart=true
  841. autorestart=unexpected
  842. startsecs=1
  843. startretries=3
  844. exitcodes=0,2
  845. stopsignal=QUIT
  846. stopwaitsecs=10
  847. user=chrism
  848. redirect_stderr=true
  849. stdout_logfile=/a/path
  850. stdout_logfile_maxbytes=1MB
  851. stdout_logfile_backups=10
  852. stderr_logfile=/a/path
  853. stderr_logfile_maxbytes=1MB
  854. stderr_logfile_backups
  855. environment=A="1",B="2"
  856. ``[eventlistener:x]`` Section Settings
  857. --------------------------------------
  858. Supervisor allows specialized homogeneous process groups ("event
  859. listener pools") to be defined within the configuration file. These
  860. pools contain processes that are meant to receive and respond to event
  861. notifications from supervisor's event system. See :ref:`events` for
  862. an explanation of how events work and how to implement programs that
  863. can be declared as event listeners.
  864. Note that all the options available to ``[program:x]`` sections are
  865. respected by eventlistener sections *except* for
  866. ``stdout_capture_maxbytes`` and ``stderr_capture_maxbytes`` (event
  867. listeners cannot emit process communication events, see
  868. :ref:`capture_mode`).
  869. ``[eventlistener:x]`` Section Values
  870. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  871. ``[eventlistener:x]`` sections have a few keys which ``[program:x]``
  872. sections do not have.
  873. ``buffer_size``
  874. The event listener pool's event queue buffer size. When a listener
  875. pool's event buffer is overflowed (as can happen when an event
  876. listener pool cannot keep up with all of the events sent to it), the
  877. oldest event in the buffer is discarded.
  878. ``events``
  879. A comma-separated list of event type names that this listener is
  880. "interested" in receiving notifications for (see
  881. :ref:`event_types` for a list of valid event type names).
  882. ``result_handler``
  883. A `pkg_resources entry point string
  884. <http://peak.telecommunity.com/DevCenter/PkgResources>`_ that
  885. resolves to a Python callable. The default value is
  886. ``supervisor.dispatchers:default_handler``. Specifying an alternate
  887. result handler is a very uncommon thing to need to do, and as a
  888. result, how to create one is not documented.
  889. Consult :ref:`programx_section` for other allowable keys, delta the
  890. above constraints and additions.
  891. ``[eventlistener:x]`` Section Example
  892. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  893. .. code-block:: ini
  894. [eventlistener:theeventlistenername]
  895. command=/bin/eventlistener
  896. process_name=%(program_name)s_%(process_num)02d
  897. numprocs=5
  898. events=PROCESS_STATE
  899. buffer_size=10
  900. priority=-1
  901. autostart=true
  902. autorestart=unexpected
  903. startsecs=1
  904. startretries=3
  905. exitcodes=0,2
  906. stopsignal=QUIT
  907. stopwaitsecs=10
  908. user=chrism
  909. redirect_stderr=true
  910. stdout_logfile=/a/path
  911. stdout_logfile_maxbytes=1MB
  912. stdout_logfile_backups=10
  913. stderr_logfile=/a/path
  914. stderr_logfile_maxbytes=1MB
  915. stderr_logfile_backups
  916. environment=A="1",B="2"
  917. ``[rpcinterface:x]`` Section Settings
  918. -------------------------------------
  919. Adding ``rpcinterface:x`` settings in the configuration file is only
  920. useful for people who wish to extend supervisor with additional custom
  921. behavior.
  922. In the sample config file, there is a section which is named
  923. ``[rpcinterface:supervisor]``. By default it looks like the
  924. following.
  925. .. code-block:: ini
  926. [rpcinterface:supervisor]
  927. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  928. The ``[rpcinterface:supervisor]`` section *must* remain in the
  929. configuration for the standard setup of supervisor to work properly.
  930. If you don't want supervisor to do anything it doesn't already do out
  931. of the box, this is all you need to know about this type of section.
  932. However, if you wish to add rpc interface namespaces in order to
  933. customize supervisor, you may add additional ``[rpcinterface:foo]``
  934. sections, where "foo" represents the namespace of the interface (from
  935. the web root), and the value named by
  936. ``supervisor.rpcinterface_factory`` is a factory callable which should
  937. have a function signature that accepts a single positional argument
  938. ``supervisord`` and as many keyword arguments as required to perform
  939. configuration. Any extra key/value pairs defined within the
  940. ``[rpcinterface:x]`` section will be passed as keyword arguments to
  941. the factory.
  942. Here's an example of a factory function, created in the
  943. ``__init__.py`` file of the Python package ``my.package``.
  944. .. code-block:: python
  945. from my.package.rpcinterface import AnotherRPCInterface
  946. def make_another_rpcinterface(supervisord, **config):
  947. retries = int(config.get('retries', 0))
  948. another_rpc_interface = AnotherRPCInterface(supervisord, retries)
  949. return another_rpc_interface
  950. And a section in the config file meant to configure it.
  951. .. code-block:: ini
  952. [rpcinterface:another]
  953. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  954. retries = 1
  955. ``[rpcinterface:x]`` Section Values
  956. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  957. ``supervisor.rpcinterface_factory``
  958. ``pkg_resources`` "entry point" dotted name to your RPC interface's
  959. factory function.
  960. *Default*: N/A
  961. *Required*: No.
  962. *Introduced*: 3.0
  963. ``[rpcinterface:x]`` Section Example
  964. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  965. .. code-block:: ini
  966. [rpcinterface:another]
  967. supervisor.rpcinterface_factory = my.package:make_another_rpcinterface
  968. retries = 1
  969. Environment Variable Interpolation
  970. ----------------------------------
  971. There may be a time where it is necessary to avoid hardcoded values in your
  972. configuration file (such as paths, port numbers, username, etc). Some teams
  973. may also put their supervisord.conf files under source control but may want
  974. to avoid committing sensitive information into the repository.
  975. With this, **all** the environment variables inherited by the ``supervisord``
  976. process are available and can be interpolated / expanded in **any**
  977. configuration value, under **any** section.
  978. Your configuration values may contain Python expressions for expanding
  979. the environment variables using the ``ENV_`` prefix. The sample syntax is
  980. ``foo_key=%(ENV_FOO)s``, where the value of the environment variable ``FOO``
  981. will be assigned to the ``foo_key``. The string values of environment
  982. variables will be converted properly to their correct types.
  983. .. note::
  984. - some sections such as ``[program:x]`` have other extra expansion options.
  985. - environment variables in the configuration will be required, otherwise
  986. supervisord will refuse to start.
  987. - any changes to the variable requires a restart in the ``supervisord``
  988. daemon.
  989. An example configuration snippet with customizable values:
  990. .. code-block:: ini
  991. [supervisord]
  992. logfile = %(ENV_MYSUPERVISOR_BASEDIR)s/%(ENV_MYSUPERVISOR_LOGFILE)s
  993. logfile_maxbytes = %(ENV_MYSUPERVISOR_LOGFILE_MAXBYTES)s
  994. logfile_backups=10
  995. loglevel = info
  996. pidfile = %(ENV_MYSUPERVISOR_BASEDIR)s/supervisor.pid
  997. nodaemon = false
  998. minfds = 1024
  999. minprocs = 200
  1000. umask = 022
  1001. user = %(ENV_USER)s
  1002. [program:cat]
  1003. command=/bin/cat -x -y --optz=%(ENV_CAT_OPTZ)s
  1004. process_name=%(program_name)s
  1005. numprocs=%(ENV_CAT_NUMPROCS)s
  1006. directory=%(ENV_CAT_DIR)s
  1007. umask=022
  1008. priority=999
  1009. autostart=true
  1010. autorestart=true
  1011. exitcodes=0,2
  1012. user=%(ENV_USER)s
  1013. redirect_stderr=false
  1014. stopwaitsecs=10
  1015. The above sample config will require the following environment variables to be set:
  1016. - ``MYSUPERVISOR_BASEDIR``
  1017. - ``MYSUPERVISOR_LOGFILE``
  1018. - ``MYSUPERVISOR_LOGFILE_MAXBYTES``
  1019. - ``USER``
  1020. - ``CAT_OPTZ``
  1021. - ``CAT_NUMPROCS``
  1022. - ``CAT_DIRECTORY``