it looks like to me that rbenv is there to set up environment variables, but a subprocess can't really affect the env of a parent process. so rbenv runs and exits without ever affecting run.sh. i dont fully understand the stderr from it, is rbenv a shell script? if so, add a 'set -x' to the top and retry, you'll get a ton of output + all the variables will be expanded.
then somehow run.sh's PATH is somehow not inclusive of 'bundle''s directory, so run.sh can't run that. in my experience, i strip out as much daemonization stuff from my jobs as is sensible (double forking, setuid, chdir) and let supervisord do as much of that as possible. one way i've achieved this (especially w/ java jobs), is to just run them normally without supervisor, then check ps for the necessary full cmd invocation cmd lines, including the processes final CWD, kill the job, paste in all that info to the program config. On Wed, Nov 9, 2011 at 8:02 AM, Brian Troutwine <[email protected]> wrote: > I've daemon owned that I'd like to have system supervisor manage. The > daemon has its own user and, being done up in ruby, it's own rbenv > environment. The supervisord conf for the daemon: > > [program:hooks] > command=/home/hooks/bin/run.sh > user=hooks > > environment=HOME='/home/hooks',USER=hooks,PATH='/home/hooks/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' > > > where `/home/hooks/bin/run.sh` looks like: > > #!/bin/bash -e > > rbenv init - > > cd /home/carehooks/src/ > bundle install > > thin --timeout 0 --environment 'production' --rackup > `pwd`/config.ru --chdir examples/ start > > Now, the result: > > # supervisorctl start hooks > hooks: ERROR (abnormal termination) > > # cat /var/log/supervisor/hooks-stderr---supervisor-e2Myrz.log > /bin/readlink: missing operand > Try `/bin/readlink --help' for more information. > /home/hooks/bin/run.sh: line 6: bundle: command not found > > # cat /var/log/supervisor/hooks-stdout---supervisor-ndpvIv.log > export PATH="/home/hooks/.rbenv/shims:${PATH}" > source "/home/hooks/.rbenv/libexec/../completions/rbenv.bash" > rbenv rehash 2>/dev/null > function rbenv() { > command="$1" > if [ "$#" -gt 0 ]; then > shift > fi > > case "$command" in > shell) > eval `rbenv "sh-$command" "$@"`;; > *) > command rbenv "$command" "$@";; > esac > } > > Is my supervisord configuration at fault, or rbenv? How can I get the > two to co-exist? > > -- > Brian L. Troutwine > > Duplicated at ServerFault: http://serverfault.com/q/329349/67165 > _______________________________________________ > Supervisor-users mailing list > [email protected] > http://lists.supervisord.org/mailman/listinfo/supervisor-users > _______________________________________________ Supervisor-users mailing list [email protected] http://lists.supervisord.org/mailman/listinfo/supervisor-users
