Remote start of code via ssh does not work
On a gentoo-server I have some piece of code which can be started as
Code:
cd path/to/code; php5 prog.php& Code:
ssh user@1.2.3.4 "cd path/to/code; php5 prog.php&" |
if you fork the process then the script will end, when the script ends, the ssh connection will close and kill all child processes under it. You'd need to run it via something like screen or nohup to have it persist.
|
i think you can possibly do it with an expect script
|
Thanks, I have tried with nohup, but process does not seem to start at first. Here is the full command I have tried:
Code:
ssh user@1.2.3.4 "cd path/to/code; nohup php5 prog.php&" Code:
ssh user@1.2.3.4 "cd path/to/code; nohup php5 prog.php"& |
well the first would be what I'd expect to work, offhand I'm not sure why it didn't tbh. Might be interesting to make a short script to wrap the commands and run that directly from nohup.
The second is not a good alternative though, you're forking the ssh locally, so it's still all underpinned by the ssh connection, which you've just cut into the background on the client. |
All times are GMT -5. The time now is 02:01 PM. |