batch file never ends

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
aristosv
Posts: 19
Joined: 07 Nov 2013 01:57

batch file never ends

#1 Post by aristosv » 01 Dec 2015 15:17

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

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: batch file never ends

#2 Post by einstein1969 » 01 Dec 2015 15:26

perhaps you must use the "nohup" command for the /etc/start plus the "&" background

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

Einstein1969

aristosv
Posts: 19
Joined: 07 Nov 2013 01:57

Re: batch file never ends

#3 Post by aristosv » 01 Dec 2015 15:57

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.

einstein1969
Expert
Posts: 960
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: batch file never ends

#4 Post by einstein1969 » 02 Dec 2015 04:42

I don't know plink. It's a batch file?

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

Einstein1969

Post Reply