Running a bash script from Meteor

I know, it’s horrible sounding, but I’m trying to use ShellJS to run an actual bast script.

Issue is when i run pwd I see it shows the actual location to be in /home/me/project/.meteor/local/bundle/programs/server/

So, putting my script in there is a bit weird since that is a built directory, correct?

How do I refer to the “server” directory for a file? (e.g. /home/me/project/server/) and keep it consistent from install to install?

I’m certain this is fairly simple and my brain just isn’t working today, but can’t seem to wrap my head around it.

Maybe try putting your script file under /private and accessing it using the Assets API? For example, the absolute file path method. That way you can hand-wave the actual server location of your bash file, which is probably ideal.

5 Likes

Actually something rather useful, especially if done right, using child_process.spawn(). Sometimes building binaries with node-gyp is just overkill.

2 Likes

Yeah I’m going to echo that this is perfectly fine. Easiest way to link different tools together and take advantage of multiple processes

1 Like