How to execute shell script to restart server by application

1

I need to run a shell from rails with a small difference, I need the script to continue running even if the server process (puma) is killed.

I added an update system inside my application, but I need to restart the server to work the changes. When I run the sh file to restart the server, it shuts down the server and stops script execution and consequently does not restart the server.

    
asked by anonymous 06.09.2016 / 21:36

1 answer

1

In order for you to run a script unrelated to the process that started it, you need to send it to the background. For example if you are running:

  

sh ./meuscript.sh

just add & in the execution it will start to run regardless of the process that created it, thus:

  

sh ./meuscript.sh &

So the process that created it can be closed, without it being too.

    
07.09.2016 / 22:24