Start a Backup run
355194
def backup(path, name=None):
    """"""
    from PyHardLinkBackup.phlb.phlb_main import backup

    backup(path, name)
937171
def run(state, command, args):
    """"""
    from ..core import do_run
    do_run(
        command=command, args=args, three=state.three, python=state.python, pypi_mirror=state.pypi_mirror
    )
197367
def setup(self):
        
        if self.backup:
            shutil.copy(self.input_file, "{}.orig".format(self.input_file))
453895
def start(self):
        """'"""
        self._process = threading.Thread(target=self._background_runner)
        self._process.start()
1170996
function proceedWithBackup() {
    if (options.resume) {
      // pick up from existing log file from previous run
      downloadRemainingBatches(options.log, db, ee, start, batchesPerDownloadSession, options.parallelism);
    } else {
      // create new log file and process
      spoolchanges(db, options.log, options.bufferSize, ee, function(err) {
        if (err) {
          ee.emit('error', err);
        } else {
          downloadRemainingBatches(options.log, db, ee, start, batchesPerDownloadSession, options.parallelism);
        }
      });
    }
  }
1369835
def run_start(args):
    """"""

    # Configure Logging
    setup_logging()

    logger.info('BigchainDB Version %s', bigchaindb.__version__)
    run_recover(bigchaindb.lib.BigchainDB())

    if not args.skip_initialize_database:
        logger.info('Initializing database')
        _run_init()

    logger.info('Starting BigchainDB main process.')
    from bigchaindb.start import start
    start(args)
1281220
def run():
    """"""
    
    # Grab server args
    args = client_helper.grab_server_args()

    # Start up workbench connection
    workbench = zerorpc.Client(timeout=300, heartbeat=60)
    workbench.connect('tcp://'+args['server']+':'+args['port'])

    # Upload the files into workbench
    my_file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                           '../data/pcap/gold_xxx.pcap')
    with open(my_file,'rb') as f:

        # We're going to upload the file in chunks to workbench 
        filename = os.path.basename(my_file)
        raw_bytes = f.read()
        md5_list = []
        for chunk in chunks(raw_bytes, 1024*1024):
            md5_list.append(workbench.store_sample(chunk, filename, 'exe'))

        # Now we just ask Workbench to combine these
        combined_md5 = workbench.combine_samples(md5_list, filename, 'exe')
        real_md5 = workbench.store_sample(raw_bytes, filename, 'exe')
        assert(combined_md5 == real_md5)
854634
def start(self):
        """"""
        self.agent.submit(self._start())
        self.is_running = True
381330
def run(self, once=False):
        """"""
        self._once = once
        self.start()
        while self.running:
            try:
                time.sleep(1.0)
            except KeyboardInterrupt:
                self.stop()
                self.join()
700139
private void backup(final FileObject _backup,
                        final int _number)
        throws FileSystemException
    {
        if (_number < this.numberBackup) {
            final FileObject backFile = this.manager.resolveFile(this.manager.getBaseFile(),
                    this.storeFileName + VFSStoreResource.EXTENSION_BACKUP + _number);
            if (backFile.exists()) {
                backup(backFile, _number + 1);
            }
            _backup.moveTo(backFile);
        } else {
            _backup.delete();
        }
    }
242027
def make_backups(self, block_id):
        
        assert self.setup, "Not set up yet.  Call .db_setup() first!"

        # make a backup?
        if self.backup_frequency is not None:
            if (block_id % self.backup_frequency) == 0:

                backup_dir = config.get_backups_directory(self.impl, self.working_dir)
                if not os.path.exists(backup_dir):
                    try:
                        os.makedirs(backup_dir)
                    except Exception, e:
                        log.exception(e)
                        log.error("FATAL: failed to make backup directory '%s'" % backup_dir)
                        traceback.print_stack()
                        os.abort()

                for p in self.get_state_paths(self.impl, self.working_dir):
                    if os.path.exists(p):
                        try:
                            pbase = os.path.basename(p)
                            backup_path = os.path.join(backup_dir, pbase + (".bak.{}".format(block_id - 1)))

                            if not os.path.exists(backup_path):
                                rc = sqlite3_backup(p, backup_path)
                                if not rc:
                                    log.warning("Failed to back up as an SQLite db.  Falling back to /bin/cp")
                                    shutil.copy(p, backup_path)
                            else:
                                log.error("Will not overwrite '%s'" % backup_path)

                        except Exception, e:
                            log.exception(e)
                            log.error("FATAL: failed to back up '%s'" % p)
                            traceback.print_stack()
                            os.abort()

        return
1128024
def makeBackupFile(self, dstPath, fileName):
        

        with open(os.devnull) as devnull:
            SP.call(['mongodump', '--db', self.dbName, '--out', dstPath],
                    stdout=devnull,
                    stderr=devnull)
            SP.call(['zip',
                     '-r',
                     os.path.join(dstPath, fileName),
                     os.path.join(dstPath, self.dbName)],
                    stdout=devnull,
                    stderr=devnull)

        SP.call(['rm', '-rf', os.path.join(dstPath, self.dbName)])
1313745
private function startRestoreService( StorageboxData $data, $backupKey, Database $database, OutputInterface $output) {
		$stackName = $data->getBackup()->getStackName();

		$restoreService = new Service();
		$restoreService->setImage('ipunktbs/xtrabackup:1.1.1');
		$restoreService->setName('restore-'.$backupKey);
		$restoreService->setCommand('restore '.$backupKey);
		$restoreService->setRestart(Service::RESTART_START_ONCE);

		$mysqlVolume = $this->makeVolume($data);
		$backupVolume = $this->makeBackupVolume($database);
		$restoreService->addVolume( $mysqlVolume );
		$restoreService->addVolume( $backupVolume );

		/**
		 * @var SchedulerParser $schedulerParser
		 */
		//$schedulerParser = container(SchedulerParser::class);
		$schedulerParser = container('scheduler-parser');
		$config = new ArrayConfiguration([
			'scheduler' => [
				'should-have-tags' => [ 'primary-restore' ]
			]
		]);
		$schedulerParser->parse($restoreService, $config);


		$restoreInfrastructure = new Infrastructure();
		$restoreInfrastructure->addService($restoreService);

		$this->infrastructureWriter->setPath( $this->getWorkDirectory() )
			->setSkipClear(false)
			->write($restoreInfrastructure, new FileWriter());
		$output->writeln("Starting ".$restoreService->getName().".");
		$this->rancherService->start( $this->getWorkDirectory(), $stackName);
		$output->writeln("Waiting for ".$restoreService->getName()." to finish.");
		$this->rancherService->wait($stackName, $restoreService->getName(), new HealthStateMatcher('started-once') );
		$output->writeln($restoreService->getName()." finished.");

		return $restoreService;
	}
1189910
def main(catalogs, include_data=True, use_short_path=True):
    
    include_data = bool(int(include_data))
    make_catalogs_backup(catalogs.split(
        ","), include_data=include_data, use_short_path=use_short_path)
495443
def start
      if ENV['rvm_path']
        sh "rvmsudo vhost run #{run_options}"
      else
        vhost = File.expand_path('../../bin/vhost', __dir__)
        sh "bundle exec sudo env PATH=#{ENV['PATH']} #{vhost} run #{run_options}"
      end
      sleep 1
      self.device = @device if @device
    end
664116
def new_run(self):
        """"""
        self.current_run += 1
        self.runs.append(RunData(self.current_run + 1))
458044
private function makeBackup ()
    {
        $this->createDirectory($this->backupDirectory);
        $this->createDirectory($this->backupDirectory . '/config');

        File::copyDirectory('app', $this->backupDirectory . '/app');
        File::copyDirectory('bootstrap', $this->backupDirectory . '/bootstrap');
        File::copyDirectory('routes', $this->backupDirectory . '/routes');

        File::copy('composer.json', $this->backupDirectory . '/composer.json');
        File::copy('config/auth.php', $this->backupDirectory . '/config/auth.php');
        File::copy('config/database.php', $this->backupDirectory . '/config/database.php');
    }