首先,我使用vba自动化腻子,使用ssh登录许多主机以获取信息并保存。
我目前可以执行此操作,但是,每次执行命令时,都必须设置一些等待时间,以便正确执行命令,然后才能执行下一条命令。有什么方法可以将腻子输出的费用返还到vba中,以便vba知道何时发送下一条命令?这样可以减少执行时间
@SpringBootApplication
public class So53521657Application {
public static void main(String[] args) {
SpringApplication.run(So53521657Application.class, args);
}
@Bean
public CachingSessionFactory<FTPFile> sf() {
DefaultFtpSessionFactory sf = new DefaultFtpSessionFactory();
sf.setHost("10.0.0.3");
sf.setUsername("ftptest");
sf.setPassword("ftptest");
return new CachingSessionFactory<>(sf);
}
@Bean
public IntegrationFlow webToFtpFlow() {
return IntegrationFlows.from(SendToFtpDirect.class)
.log()
.handle(Ftp.outboundAdapter(sf()).remoteDirectory("foo"))
.get();
}
@Bean
public IntegrationFlow ftpToLocalFlow() {
return IntegrationFlows.from(Ftp.inboundAdapter(sf())
.remoteDirectory("foo")
.deleteRemoteFiles(true)
.localFilter(new SimplePatternFileListFilter("*.csv"))
.localDirectory(new File("/tmp/foo")), e ->
e.poller(Pollers.fixedDelay(5_000)))
.log()
.<File>handle((p, h) -> {
File newFile = new File("/tmp/bar/" + p.getName().replace(".csv", ".txt"));
newFile.delete();
System.out.println("renaming " + p + " to " + newFile);
p.renameTo(newFile);
return p;
})
.log()
.nullChannel();
}
@Bean
public IntegrationFlow localToFtpFlow() {
return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/bar"))
.filter(new FileSystemPersistentAcceptOnceFileListFilter(
new SimpleMetadataStore(), "foo")), e ->
e.poller(Pollers.fixedDelay(10_000)))
.log()
.handle(Ftp.outboundAdapter(sf())
.remoteDirectory("bar"))
.get();
}
}
@RestController
@DependsOn("webToFtpFlow")
class Controller {
@Autowired
private SendToFtpDirect gate;
@GetMapping(path = "/send/{name}")
public String send(@PathVariable String name) {
gate.send("foo".getBytes(), name + ".csv");
return name + " sent";
}
}
interface SendToFtpDirect {
void send(byte[] bytes, @Header(FileHeaders.FILENAME) String filename);
}
sub retrievinginfo()
Lines to ssh open putty to X host
SendKeys "first command for putty session"
Application.wait Now+Timeserial(0,0,"estimated seconds") '<---- here the problem
结束