设置一个docker文件,使用以下配置在virtualbox下的ubuntu内启动supervisord
实例:
[supervisord]
nodaemon=true
[program:install]
command=bash -c "/src/etc/install.sh"
directory=/src/etc/
autorestart=true
autostart=true
stopwaitsecs=90
redirect_stderr=true
stdout_logfile=/var/log/myapp_install.log
设置为从src/etc/
目录启动以下测试脚本文件:
#!/bin/bash
echo "testing"
当我启动/usr/local/bin/supervisord
时,我得到以下输出:
/usr/local/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2014-03-16 00:56:40,709 CRIT Supervisor running as root (no user in config file)
2014-03-16 00:56:40,723 INFO supervisord started with pid 1
2014-03-16 00:56:41,728 INFO spawned: 'install' with pid 8
2014-03-16 00:56:42,730 INFO success: install entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
此时,应用程序无限期挂起。
如果我尝试获取ls
目录的/var/log
,则没有证据表明myapp_install.log
文件曾被创建过。
显然我没有正确设置我的supervisord.conf
文件,但它告诉我它已成功启动脚本然后挂起,直到我ctrl-c
,这真的很奇怪。