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
batch file never ends
Moderator: DosItHelp
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: batch file never ends
perhaps you must use the "nohup" command for the /etc/start plus the "&" background
https://en.wikipedia.org/wiki/Nohup
Einstein1969
https://en.wikipedia.org/wiki/Nohup
Einstein1969
Re: batch file never ends
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.
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: batch file never ends
I don't know plink. It's a batch file?
Can you do a try using "nohup \etc\start &" ?
Einstein1969
Can you do a try using "nohup \etc\start &" ?
Einstein1969