def cmd_schedule(opts, args, overDict): if len(args) < 2: return 2 if not os.path.isdir(os.path.abspath(args[1])): print 'folder %s not exist\n' % args[1] return 1 backupDir = os.path.abspath(args[1]) if len(args) < 3: url = webcontrol._PAGE_BACKUP_SHEDULE + '?backupdir=%s' % ( misc.pack_url_param(backupDir),) run_url_command(url).addCallback(print_and_stop) reactor.run() return 0 shed = schedule.from_compact_string(args[2]) if shed is None: print schedule.format() print return 0 url = webcontrol._PAGE_BACKUP_SHEDULE + '?action=save&submit=save&backupdir=%s&type=%s&interval=%s&daytime=%s&details=%s' % ( misc.pack_url_param(backupDir), shed.type, shed.interval, shed.daytime, misc.pack_url_param(shed.details),) run_url_command(url).addCallback(print_and_stop) reactor.run() return 0
def cmd_schedule(opts, args, overDict): if len(args) < 2: return 2 from system import bpio if not bpio.pathIsDir(os.path.abspath(args[1])): print_text('folder %s not exist\n' % args[1]) return 1 backupDir = os.path.abspath(args[1]) if len(args) < 3: return call_xmlrpc_method_and_stop('getschedule', backupDir) from lib import schedule shed = schedule.from_compact_string(args[2]) if shed is None: print_text(schedule.format()+'\n') return 0 return call_xmlrpc_method_and_stop( 'setschedule', backupDir, shed.type, shed.interval, shed.daytime, shed.details,)