nadermx
nadermx

Reputation: 2776

Supervisor not detecting file

I am trying to run a command via a proxy. When I run this command in shell it works

http_proxy=http://username:password@proxy:29800 /home/www/program -env prod

But when I put this into my supervisor config it tells me it can't find this file

[program:goprogram]
command = http_proxy=http://username:password@proxy:29800 home/www/program -env prod
directory = /home/www/program
enviroment=PATH='/home/www/env/bin:/usr/bin'
user = user
autorestart = true

Now, I assume it has to do with the http_proxy or syntax, but not sure how to fix it.

Upvotes: 1

Views: 314

Answers (2)

TheHippo
TheHippo

Reputation: 63189

You need to set the http_proxy variable. Either the way @VonC described it or:

[program:goprogram]
command = home/www/program -env prod
directory = /home/www/program
enviroment=
    PATH='/home/www/env/bin:/usr/bin'
    http_proxy=http://username:password@proxy:29800
user = user
autorestart = true

More information can be found in this SO question.

Upvotes: 1

VonC
VonC

Reputation: 1330082

Since you are trying to set up an environment variable in the command itself, you might try a different way to call said command:

command = /bin/sh -c 'http_proxy=http://username:password@proxy:29800 home/www/program -env prod'

That way:

  • you don't have to add that environment variable to the environment section (or the credentials would be visible to all supervisord process' and child process’ environments)
  • you set http_proxy only for the command to be executed.

Upvotes: 1

Related Questions