Changeset 9470
- Timestamp:
- 04/08/10 17:17:45 (3 years ago)
- Files:
-
- modules/branches/2.8/backup/bin/ampbackup.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.8/backup/bin/ampbackup.php
r9391 r9470 78 78 if($opts['remotesshhost'] && $opts['remotesshkey']){ 79 79 $opts['now']=$opts['remotesshhost'].'.'.$opts['now']; 80 $user=(isset($opts['remote user']) && $opts['remotesshuser']!='')?$opts['remoteuser'].'\@':'';80 $user=(isset($opts['remotesshuser']) && $opts['remotesshuser']!='')?$opts['remotesshuser'].'\@':''; 81 81 $exec='/usr/bin/ssh -o StrictHostKeyChecking=no -i '.$opts['remotesshkey'].' '.$user.$opts['remotesshhost']; 82 82 $exec.=' \'. /etc/amportal.conf;'; 83 $exec.='$ASTVARLIBDIR/bin/ampbackup.php cli'; 84 print_r($opts); 83 $exec.='$ASTVARLIBDIR/bin/ampbackup.php cli '; 85 84 foreach($opts as $key => $val){ 86 85 switch($key){ … … 103 102 //if the ssh completed with exit code 0, copy backup over to this server 104 103 if($execok==0){ 104 mkdir($opts['budir'].'/'.$opts['name']);//ensure dir structure 105 105 $exec='/usr/bin/scp -i '.$opts['remotesshkey'].' -c blowfish '.$user.$opts['remotesshhost'].':'.$rbudir[0].'/backups/'.$opts['name'].'/'.$opts['now'].'.tar.gz '.$opts['budir'].'/'.$opts['name']; 106 106 exec($exec,$ret); 107 107 } 108 108 //if we have the backup file localy, delete it from the remote server 109 if(is_file($ amp_conf['ASTSPOOLDIR'].'/tmp/'.$opts['now'].'.tar.gz')){109 if(is_file($opts['budir'].'/'.$opts['name'].'/'.$opts['now'].'.tar.gz')){ 110 110 $exec='/usr/bin/ssh -o StrictHostKeyChecking=no -i '.$opts['remotesshkey'].' '.$user.$opts['remotesshhost']; 111 $exec.=' \' rm -f '.$rbudir[0].'/backups/'.$opts['name'].'/'.$opts['now'].'.tar.gz\'';111 $exec.=' \'dir='.$rbudir[0].'/backups/'.$opts['name'].'; rm -f $dir/'.$opts['now'].'.tar.gz; if [ ! "$(ls -A $dir)" ]; then rmdir $dir; fi'\''; 112 112 exec($exec,$ret); 113 113 } 114 114 if($opts['remoterestore']=='yes'){//restore to local machine if requested 115 115 include_once($amp_conf['AMPWEBROOT'].'/admin/modules/backup/functions.inc.php'); 116 backup_restore_tar($opts['budir'].'/'.$opts['name'].'/'.$opts['now'].'.tar.gz', $opts['now'].'.tar.gz','ALL');116 @backup_restore_tar($opts['budir'].'/'.$opts['name'].'/'.$opts['now'].'.tar.gz', $opts['now'].'.tar.gz','ALL'); 117 117 } 118 118 }else{//otherwise, run it localy
