Skip to main content
bagonterman
Inspiring
June 16, 2014
Question

execute command in command line.

  • June 16, 2014
  • 2 replies
  • 702 views

I am trying to connect to a local database. I can use the terminal to execute commands to the database that work. The trick is that I am having difficulty sending those commands from bridge. This is what I have tried.

app.system("Mongod --fork");

app.system("mongo");

app.system("use mydb");

app.system("db.testData.update({ name: 'bg'}, { $set: { name: 'Brett Gonterman'}})");

if I type this manually it works. If I send this through Bridge nothing happens.

How can I execute this?

This topic has been closed for replies.

2 replies

d1g1talphyre
Inspiring
July 16, 2014

BUMP!

I figured it out.  Let me walk you through so you understand.  I've been having the same issues you have been having here.

So at first I tried what you were trying to no avail.  Then I tried this...

poo = "find /Volumes/IllustratedUses -iname '" + DocumentID + "' | xargs -I '{}' cp {} /Volumes/Archive_ME/tempDir/

and behold, it worked.  I was shocked.  So I tried running a python script.  wa wa waaaa, nothing.

I went and talked to a buddy in our photo studio who is really good with bash on mac.  He said check your enviroment. 

The trick is to manually set your path variables in the line of code you want to run.

poop = "PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin; cd /Volumes/Archive_Me/tempDir/; sh illuse.sh"

app.system(poop)

and my friend that worked.  I hope this helps other people in the future. 

bagonterman
Inspiring
June 17, 2014

I tried making an executable like this

app.system("/Users/bagonterman/Desktop/MongoData.sh");

but it does nothing. In the toolkit it says that system runs just like command line. So how is this not running?

bagonterman
Inspiring
June 17, 2014

I also tried this

app.system("osascript do shell script '/Users/bagonterman/Desktop/MongoData.sh'");