Changeset 1028
- Timestamp:
- 03/03/09 02:14:32 (3 years ago)
- File:
-
- 1 edited
-
trunk/scripts/mirror-backup (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/mirror-backup
r1027 r1028 8 8 define("IA_BACKUP_SSL_CERT", "$home_dir/.ssh/ia-backup"); 9 9 10 function week_timestamp() { 11 return date("YW"); 12 } 13 10 14 function check_env() { 11 15 log_assert(is_dir(IA_BACKUP_REPO_DIR)); … … 14 18 } 15 19 16 function exec_rsync($source_dir, $target_dir ) {20 function exec_rsync($source_dir, $target_dir, $delete_extraneous=false) { 17 21 log_print("rsync $source_dir -> $target_dir"); 18 $cmd = sprintf("rsync -avC --delete --rsh='ssh -p 21883 -i %s' " 22 $delete_arg = $delete_extraneous ? '--delete' : ''; 23 $cmd = sprintf("rsync -avC {$delete_arg} --rsh='ssh -p 21883 -i %s' " 19 24 ."backup@infoarena.ro:%s %s/%s", IA_BACKUP_SSL_CERT, $source_dir, 20 25 IA_BACKUP_REPO_DIR, $target_dir); … … 23 28 24 29 function sync_attachments() { 25 $new_snapshot = backup_timestamp();30 $new_snapshot = week_timestamp(); 26 31 if (!is_dir(IA_BACKUP_REPO_DIR."/attach")) { 27 32 mkdir(IA_BACKUP_REPO_DIR."/attach"); 28 33 } 29 $last_snapshot = exec(sprintf("ls - tr1 '%s'",34 $last_snapshot = exec(sprintf("ls -1 '%s'", 30 35 IA_BACKUP_REPO_DIR."/attach")); 31 36 if ($last_snapshot && $last_snapshot != $new_snapshot) { … … 37 42 } 38 43 log_print("Syncing last snapshot"); 39 exec_rsync('attach-live/', "attach/$new_snapshot/" );44 exec_rsync('attach-live/', "attach/$new_snapshot/", true); 40 45 } 41 46
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)