简体   繁体   中英

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

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")

tar ... | runs tar. Learn how pipes work.

at reads the commands from standard input. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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