4

Toolset:

  • Laravel 5.2.*
  • LaravelCollective remote package ^5.2

Let's say I have a route http://example.com/npm when I hit this route I process some request parameters and then ssh into a remote server using the LaravelCollective remote package.

After some time I see in my logs that the connection is closed. I know this because that message is logged after the ssh command. So my applications tells me that my command is executed successfully. But when I go and check the server there is no node_modules folder, but after hitting the route 10x is suddenly is there.

That made me think that my connection is closed even the commands where not finished. To be sure about that I started monitoring the process on ther server with the following command

ps aux 

This resulted in the fact that I got my success message but the process was still running on my server, which means the output I get is not correct and it prevents a follow-up command to fail (gulp production)

I dug a bit into the source code to see that there is a way to keep that connection open but no luck so far.

The question: can I keep this connection open until the commands are definitely finished so that my response to the end user is correct?

Joren Van Hocht
  • 845
  • 1
  • 9
  • 21
  • Did you find any solution? – zono Sep 23 '16 at 18:16
  • @zono so far I did not find any solution. I did open an issue on github. https://github.com/LaravelCollective/remote/issues/28 – Joren Van Hocht Sep 26 '16 at 06:52
  • I found that issue before. I didn't notice this was yours. I added a very long time-out setting in remote.php as a workaround. Thank you so much for your response. – zono Sep 26 '16 at 15:59
  • How are running your commands? Can you provide an example? I also think about a workaround by using another approach: You could make your remote script to hit your Laravel app to a webhook to submit the process termination status (i.e. CURL or similar). This would be clean in terms of not hanging remote connections too long. – alariva Nov 25 '16 at 01:25

0 Answers0