def run(self): # Assure that only one instance of ArGyver is running. lock = PidLock(server_root=self.config.get_server_root()) if lock.locked(): warning("ArGyver already running with pid %d!" % lock.pid()) else: # Create a lock file in the /tmp folder lock.lock() # For each source folder: synchronize, archive, free disk space for [dst, src] in self.sources.iteritems(): self.rsync(src, dst) self.update_db_snapshot(dst) self.archive() self.link_files() self.update_db_versions() self.update_db_repository() # TODO: self.update_db_history() self.remove_tmp_folder() self.finish() # Remove the lock file lock.unlock()
if opt_resume: # explicit resume if opt_simulate: fatal("--resume and --simulate incompatible: you can only resume real backups") if opt_disable_resume: fatal("--resume and --disable-resume incompatible") if registry.backup_resume_conf is None: fatal("no previous backup session to resume from") if opt_simulate and registry.backup_resume_conf and not opt_disable_resume: fatal("--simulate will destroy your aborted backup session. To force use --disable-resume") lock = PidLock(PATH_PIDLOCK, nonblock=True) try: lock.lock() except lock.Locked: fatal("a previous backup is still in progress") if conf.s3_parallel_uploads > 1 and conf.s3_parallel_uploads > (conf.volsize / 5): warn("s3-parallel-uploads > volsize / 5 (minimum upload chunk is 5MB)") if not raw_upload_path: try: update_profile(conf.force_profile) except hub.Backups.NotInitialized, e: fatal("you need a profile to backup, run tklbam-init first") credentials = None
if opt_disable_resume: fatal("--resume and --disable-resume incompatible") if registry.backup_resume_conf is None: fatal("no previous backup session to resume from") if opt_simulate and registry.backup_resume_conf and not opt_disable_resume: fatal("--simulate will destroy your aborted backup session. To force use --disable-resume") if opt_simulate and dump_path: fatal("--simulate and --dump are incompatible") if raw_upload_path and dump_path: fatal("--raw-upload and --dump are incompatible") lock = PidLock("/var/run/tklbam-backup.pid", nonblock=True) try: lock.lock() except lock.Locked: fatal("a previous backup is still in progress") if conf.s3_parallel_uploads > 1 and conf.s3_parallel_uploads > (conf.volsize / 5): warn("s3-parallel-uploads > volsize / 5 (minimum upload chunk is 5MB)") hb = hub.Backups(registry.sub_apikey) if not raw_upload_path: try: registry.update_profile(conf.force_profile) except registry.CachedProfile, e: warn(e)