简体   繁体   English

使用命令(bash终端)无法执行命令

[英]commands do not get executed using at (bash terminal)

I'm trying to backup a directory on a scheduled time using at 我正在尝试在预定时间使用备份目录

That's an example i tried: 这是我尝试的示例:

tar -cvf ~/backup.tar ~/Music | at 13:00

but this immediately creates the backup without waiting for 13:00 但这会立即创建备份,而无需等待13:00

I thought of using 我想到了

at 13:00 << EOF 
tar -cvf ~/backup.tar ~/Music 
EOF

but this never executed the command 但这从未执行过命令

what can I do to run the command on a scheduled time?(i must only use "at") 如何在预定的时间运行命令?(我只能使用“ at”)

tar ... | runs tar. 运行tar。 Learn how pipes work. 了解管道的工作原理。

at reads the commands from standard input. at从标准输入读取命令。 You can use a pipe to send a command to it, but you have to feed the command to the pipe, not its output: 您可以使用管道向其发送命令,但必须将命令而不是其输出提供给管道:

echo tar -cvf ~/backup.tar ~/Music | at 13:00

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM