WebFaction
Community site: login faq

I'm building a deploytment api/script and I'm checking whats currently installed.

when I run server.system(session_id, 'which pip') for example I get a fault saying command doesn't exist.

But I can login via ssh and run the same 'which pip' and get a valid response.

Any ideas

asked 11 Mar '11, 13:25

limeyd
324
accept rate: 0%


Are your paths defined in .bashrc? Many times they will be defined in .bash_profile, which sets environment for SSH connections. But for headless connections the settings belong in .bashrc. If a path to ~/bin is not in .bashrc the api call will not be able to locate the binary.

permanent link

answered 11 Mar '11, 14:41

johns
5.4k412
accept rate: 23%

yes it is, that was my first check. If I call server.system(seesion_id,'echo $PATH') my additions to the path are not getting appended. But if I run through ssh they are ?

Weired stuff

/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/home/ph/trunk/python-hosting.com/new_site/monitor:/home/ph/trunk/python-hosting.com/new_site/manual_scripts

(11 Mar '11, 15:10) limeyd

Try executing the command with the full path to the command, so

/home/user/bin/pip

That way you are not relying on the system path environment. This is similar to running an app as cron and appears to simply be a limitation of the API

(11 Mar '11, 15:20) johns

You may also want to check this post,

http://community.webfaction.com/questions/2116/change-working-directory-when-using-webfaction-apis-system-method

It explains another approach to the issue.

(11 Mar '11, 15:25) johns

thanks I see now the each system call is unique and ENVs are not persistent between them. As this is setup script I'll be adding all env to .bashrc in the beginning then when calling system I'll prepend source ~/.bashrc;command1;command2; etc.. thanks for the help john.

(11 Mar '11, 15:53) limeyd
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×76
×7
×2

question asked: 11 Mar '11, 13:25

question was seen: 2,570 times

last updated: 11 Mar '11, 15:54

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM