supervisord环境变量它没有传递给test_app.sh

时间:2015-10-12 13:26:05

标签: bash environment-variables supervisord

supervisord 3.1.1

我正在尝试将变量从supervisord配置传递给test_app.sh

[program:test_app]
command   = /home/korek/webapps/test_app.sh
user = korek
environment=DBPASSWD="dbpasswd", DBLOGIN="dblogin", EPASSWD="epasswd", ELOGIN="elogin"
redirect_stderr=true
stdout_logfile = /home/korek/webapps/logs/gunicorn-supervisor.log

但是没有设置test_app.sh环境。

#!/bin/bash
env
set
echo "DBPASSWD: ${DBPASSWD}"

返回没有DBPASS,DBLOGIN,EPASS,ELOGIN的标准环境。

更新

supervisorctl

test_app                     RUNNING   pid 3994, uptime 0:10:05

从/tmp/supervisor.log

登录
2015-10-12 15:16:20,130 INFO spawned: 'test_app' with pid 3994
2015-10-12 15:16:21,376 INFO success: test_app entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

登录/home/korek/webapps/logs/gunicorn-supervisor.log

DBPASSWD: 
[2015-10-12 15:16:20 +0000] [3994] [DEBUG] Current configuration:
  proxy_protocol: False
  worker_connections: 1000
  statsd_host: None
  max_requests_jitter: 0
  post_fork: <function post_fork at 0x1632500>
  pythonpath: None
  enable_stdio_inheritance: False
  worker_class: sync
  ssl_version: 3
  suppress_ragged_eofs: True
  syslog: False
  syslog_facility: user
  when_ready: <function when_ready at 0x1632230>
  pre_fork: <function pre_fork at 0x1632398>
  cert_reqs: 0
  preload_app: False
  keepalive: 2
  accesslog: None
  group: 999
  graceful_timeout: 30
  do_handshake_on_connect: False
  spew: False
  workers: 3
  proc_name: test_app
  sendfile: True
  pidfile: None
  umask: 7
  on_reload: <function on_reload at 0x16320c8>
  pre_exec: <function pre_exec at 0x1632aa0>
  worker_tmp_dir: None
  post_worker_init: <function post_worker_init at 0x1632668>
  limit_request_fields: 100
  on_exit: <function on_exit at 0x16361b8>
  config: None
  secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'}
  proxy_allow_ips: ['127.0.0.1']
  pre_request: <function pre_request at 0x1632c08>
  post_request: <function post_request at 0x1632cf8>
  user: 7947
  forwarded_allow_ips: ['127.0.0.1']
  worker_int: <function worker_int at 0x16327d0>
  threads: 1
  max_requests: 0
  limit_request_line: 4094
  access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
  certfile: None
  worker_exit: <function worker_exit at 0x1632e60>
  chdir: /home/korek/webapps/
  paste: None
  default_proc_name: deployment.wsgi:application
  errorlog: -
  loglevel: debug
  logconfig: None
  syslog_addr: udp://localhost:514
  syslog_prefix: None
  daemon: False
  ciphers: TLSv1
  on_starting: <function on_starting at 0x162fed8>
  worker_abort: <function worker_abort at 0x1632938>
  bind: ['unix:/home/korek/webapps/run/gunicorn.sock']
  raw_env: []
  reload: False
  check_config: False
  limit_request_field_size: 8190
  nworkers_changed: <function nworkers_changed at 0x1636050>
  timeout: 30
  ca_certs: None
  django_settings: None
  tmp_upload_dir: None
  keyfile: None
  backlog: 2048
  logger_class: gunicorn.glogging.Logger
  statsd_prefix: 
[2015-10-12 15:16:20 +0000] [3994] [INFO] Starting gunicorn 19.3.0
[2015-10-12 15:16:20 +0000] [3994] [DEBUG] Arbiter booted
[2015-10-12 15:16:20 +0000] [3994] [INFO] Listening at: unix:/home/korek/webapps/run/gunicorn.sock (3994)
[2015-10-12 15:16:20 +0000] [3994] [INFO] Using worker: sync
[2015-10-12 15:16:20 +0000] [4010] [INFO] Booting worker with pid: 4010
[2015-10-12 15:16:20 +0000] [4011] [INFO] Booting worker with pid: 4011
[2015-10-12 15:16:20 +0000] [4012] [INFO] Booting worker with pid: 4012
[2015-10-12 15:16:20 +0000] [3994] [DEBUG] 3 workers
[2015-10-12 15:16:21 +0000] [3994] [DEBUG] 3 workers

test_app正在运行,因为我还没有更改环境密码的密码。

1 个答案:

答案 0 :(得分:1)

问题是我确实停止并开始test_app,我应该重新启动整个监督/etc/rc.d/rc.supervisord restart或者只是重新加载test_app,因为grimsock建议。

它现在正在工作。