neildeadman
neildeadman

Reputation: 3969

Syncing folders using bash script without rsync

I have been tasked with performing backups of a VMware vCenter appliance database. We were unable to install the Backup Exec agent for Linux so we are dumping the database to disk and then using a script SCP'ing them over to another *nix box.

This is working fine, and I have it so on the appliance we only keep a weeks worth of backups.

The issue I am having is making sure the backups on the remote machine are in sync so there is only the weeks worth on both machines.

Rsync isn't installed, so I have no idea how to handle deleting them remotely without setting up another script on the remote machine which I'd rather not do.

Any way this can all be accomplished in the one script?

Upvotes: 0

Views: 1394

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328614

If you can use scp, you can probably use ssh as well to execute remote commands.

Try:

ssh user@remote find /some/folder/with/backups -mtime +7 -type f -print

When it works, replace -print with -delete (or -exec rm "{}" \; if -delete isn't supported).

Upvotes: 1

Related Questions