MattSt
MattSt

Reputation: 1193

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

Upvotes: 0

Views: 41

Answers (1)

choroba
choroba

Reputation: 242343

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

Upvotes: 2

Related Questions