If you’d like to learn more about cron, check out this Media Temple community article. Combine rsync with cron to create scheduled backupsĬron is a useful tool that is used to schedule events that occur automatically. These differences are particularly meaningful when making regular backups, copying large sites or applications, and especially when sending that data over a network. Another is that it is possible to compress the data as it’s being copied. One is that rsync only copies the delta (difference) between the files at the source and destination, possibly saving large amounts of system resources. Often, cp (or scp) is perfectly adequate, but there are a few reasons that you should consider using rsync instead of cp. You may be wondering why you would want to use rsync in this instance instead of the simpler ‘cp’ command. h or -help: This prints a help page that has useful information about using rsync.Ĭheck out this doc for information about rsync's many other useful options. This option deletes any files or folders in the destination that aren’t at the source. delete: This flag isn’t used here, but it is a common feature of rsync. This is especially useful when copying large amounts of data. v: As with many other commands, this option asks for verbose output. a: Copies files recursively and preserves users, groups, symbolic links, file permissions, and timestamps. To accomplish this, we drop the slash after directory1: rsync -av path/to/directory1 /path/to/directory2/ In our example, the contents of directory1 are copied into directory2, but directory1 will not be created in directory2. An important consideration here is the final slash (/) in the file paths of the command. The above command copies the contents of directory1 into directory2. While connected to your server, execute the following command, replacing the file path info with yours: rsync -av /path/to/directory1/ path/to/directory2/ We’ll start with the most basic rsync format for copying (syncing) files. Begin by connecting to your server via SSH.
0 Comments
Leave a Reply. |