#!/usr/bin/python #coding=utf-8 from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.executors.pool import ThreadPoolExecutor import os import yaml import time
# We can only make full backup now #------------------Full Backup---------------------------------- if x['backup'].has_key('full') and x['backup']['full'].has_key('type') and x['backup']['full'].has_key('time'): scheduler.add_job(fullbackup,x['backup']['full']['type'], max_instances=2, **x['backup']['full']['time'])
#------------------Incremental Backup--------------------------- if x['backup'].has_key('incremental') and x['backup']['incremental'].has_key('type') and x['backup']['incremental'].has_key('time'): scheduler.add_job(incremental,x['backup']['incremental']['type'], max_instances=2, **x['backup']['incremental']['time'])
try: scheduler.start() except Exception: # When there is error in backup.yaml file whileTrue : time.sleep(86400) else: whileTrue : time.sleep(86400)