question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run only one script

See original GitHub issue

Hi!

I’m deploying my app in a elastic bean instance so basically I have the option to run just one script. If I try to run something like:

"start": "npm run build & node script.js"

it’s not guaranteed that the first one has finished before the second one starts. Is there an way to pass through that?

Ps: I’m using eb deploy from ElasticBean

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
antonsampercommented, Mar 9, 2017

Hi @ThiagoMiranda, I dont use eb deploy, I have a slightly different workflow setup on CircleCI that uses the aws elasticbeanstalk cli.

With my workflow, I generate the code that will be deployed by running npm run build. That creates my dist folder (which is in .gitignored). I then upload the dist and package.json to S3 (zipped up) and I then run aws elasticbeanstalk..... [options..] to tell Beanstalk that theres a new application that needs to be deployed.

By default, when a new application is deployed to Beanstalk, npm i --production will run as part of the application setup so you definitely don’t have to include node_modules in your application zip.

I’ve just been reading and looks like eb deploy uses the last commit as the source. This is ok but it depends on what your project/workflow is. For instance, if you’re using babel, then you would have to also commit your dist folder, otherwise your code wont be compiled.

My workflow is more fine tuned so i wouldnt be able to use eb deploy. Have a look at the links below and see if they help.

References:

0reactions
myrcutiocommented, Nov 15, 2017

not sure if you solved it or not, but the single & tells bash to run commands in parallel. if you specify && it forces it to run in sequence.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to make sure only one instance of a bash script runs?
One other way to make sure a single instance of bash script runs: #! /bin/bash - # Check if another instance of script...
Read more >
How to Ensure Only One Instance of a Bash Script Is Running
Just add the pidof line at the top of your Bash script, and you'll be sure that only one instance of your script...
Read more >
Ensure Only One Instance of a Bash Script Is Running
In this tutorial, we'll discuss different ways of ensuring only one instance of a bash script is running. This will be useful when...
Read more >
[Solved] How to run this script only once - CodeProject
Solution 1​​ Use local storage to store a flag indicating that the code has run. Then test that flag when your page loads...
Read more >
Quick-and-dirty way to ensure only one instance of a shell ...
Running from a Cron job I use flock -x -n %lock file% -c "%command%" to make sure only one instance is ever executing....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found