Page 1 of 1

batch file never ends

Posted: 01 Dec 2015 15:17
by aristosv
This is probably an issue with Linux, but it might be solvable in a batch file. So here it goes.
Running the batch file below, will run "ls" on as many Linux servers exist in "ip.txt"

for /f "tokens=*" %%a in (%~dp0ip.txt) do (
%~dp0plink -batch -ssh -pw pass root@%%a "ls"
)

Running the batch file below will run the command "start"
The problem is that the command "start" is not like "ls". "start" just keeps running, so the batch file never continues to the next server in "ip.txt"

for /f "tokens=*" %%a in (%~dp0ip.txt) do (
%~dp0plink -batch -ssh -pw pass root@%%a "/etc/start"
)

Is there a way to solve this issue?

Thanks

Re: batch file never ends

Posted: 01 Dec 2015 15:26
by einstein1969
perhaps you must use the "nohup" command for the /etc/start plus the "&" background

https://en.wikipedia.org/wiki/Nohup

Einstein1969

Re: batch file never ends

Posted: 01 Dec 2015 15:57
by aristosv
That script runs a few commands and starts 2 more scripts that use nohup and &. But still, it doesnt exit, so the batch file can continue to the next server. If I run the "start" script on the Linux server itself, after it runs the commands it finishes. But using plink it doesnt, for some reason.

Re: batch file never ends

Posted: 02 Dec 2015 04:42
by einstein1969
I don't know plink. It's a batch file?

Can you do a try using "nohup \etc\start &" ?

Einstein1969