在 sftp put 命令之间休眠

发布于 2025-01-21 00:31:22 字数 483 浏览 3 评论 0原文

有没有一种方法可以使用-c命令执行sftp,并且在文本文件中指定了sleep> sleep> sleep命令在两个put 命令?

我有一个批处理文件,该文件将SFTP并执行一些put命令。我希望该过程在执行几个put命令后等待5分钟。

sftp -b commands.txt ..

commands.txt我想要的:

put abc.txt
wait 5 mins
put xyz.txt

最坏的情况下,我可以将其在批处理文件中将其拆分为两个TXT文件,但是想知道是否有一种更简单的方法。通过sftp人页面没有找到任何可以做到这一点的东西。

Is there a way to execute sftp with the -c command and in the text file specify an equivalent of sleep command to wait between two put commands?

I have a batch file that will sftp and execute a few put commands. I want the process to wait for 5 min after executing a few put commands.

sftp -b commands.txt ..

and in commands.txt I want:

put abc.txt
wait 5 mins
put xyz.txt

Worst case I could split it in my batch file into two txt files, but was wondering if there was an easier way so I don't have an extra file to maintain. Went through the sftp man pages didn't find anything that does that.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我是有多爱你 2025-01-28 00:31:22

将命令通过管道传送到 sftp。这允许您使用 shell sleep 命令。

(
echo put abc.txt
sleep 5m
echo put xyz.txt
) | sftp -b - [email protected]

当然,您也可以在两个单独的 sftp 命令之间休眠。特别是,在长达 5 分钟的暂停时间内,连接中断的可能性不容忽视。

echo put abc.txt | sftp -b - [email protected]
sleep 5m
echo put xyz.txt | sftp -b - [email protected]

在 Windows 上,将 sleep 5m 替换为:

timeout /t 300 > nul

Pipe the commands to the sftp. That allows you to use shell sleep command.

(
echo put abc.txt
sleep 5m
echo put xyz.txt
) | sftp -b - [email protected]

You can of course sleep between two individual sftp commands too. Particularly, with such a long pause as 5 minutes, chances that the connection breaks meanwhile are not negligible.

echo put abc.txt | sftp -b - [email protected]
sleep 5m
echo put xyz.txt | sftp -b - [email protected]

On Windows, replace the sleep 5m, with:

timeout /t 300 > nul
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文