|
|
@ -1901,7 +1901,7 @@ class ConfigScheduling(object): |
|
|
|
|
|
|
|
actions = [] |
|
|
|
actions.extend(_SCHED_ACTIONS) |
|
|
|
days = get_days() |
|
|
|
day_names = get_days() |
|
|
|
conf['schedlines'] = [] |
|
|
|
snum = 1 |
|
|
|
conf['taskinfo'] = [] |
|
|
@ -1909,7 +1909,7 @@ class ConfigScheduling(object): |
|
|
|
line = ev[3] |
|
|
|
conf['schedlines'].append(line) |
|
|
|
try: |
|
|
|
m, h, day, action = line.split(' ', 3) |
|
|
|
m, h, day_numbers, action = line.split(' ', 3) |
|
|
|
except: |
|
|
|
continue |
|
|
|
action = action.strip() |
|
|
@ -1929,7 +1929,17 @@ class ConfigScheduling(object): |
|
|
|
act = '' |
|
|
|
if act in ('enable_server', 'disable_server'): |
|
|
|
action = Ttemplate("sch-" + act) + ' ' + server |
|
|
|
item = (snum, '%02d' % int(h), '%02d' % int(m), days.get(day, '**'), '%s %s' % (action, value)) |
|
|
|
|
|
|
|
if day_numbers == "1234567": |
|
|
|
days_of_week = "Daily" |
|
|
|
elif day_numbers == "12345": |
|
|
|
days_of_week = "Weekdays" |
|
|
|
elif day_numbers == "67": |
|
|
|
days_of_week = "Weekends" |
|
|
|
else: |
|
|
|
days_of_week = ", ".join([day_names.get(i, "**") for i in day_numbers]) |
|
|
|
item = (snum, '%02d' % int(h), '%02d' % int(m), days_of_week, '%s %s' % (action, value)) |
|
|
|
|
|
|
|
conf['taskinfo'].append(item) |
|
|
|
snum += 1 |
|
|
|
|
|
|
@ -1954,7 +1964,7 @@ class ConfigScheduling(object): |
|
|
|
|
|
|
|
minute = kwargs.get('minute') |
|
|
|
hour = kwargs.get('hour') |
|
|
|
dayofweek = kwargs.get('dayofweek') |
|
|
|
days_of_week = ''.join([str(x) for x in kwargs.get('daysofweek')]) |
|
|
|
action = kwargs.get('action') |
|
|
|
arguments = kwargs.get('arguments') |
|
|
|
|
|
|
@ -1964,7 +1974,7 @@ class ConfigScheduling(object): |
|
|
|
elif arguments in ('off','disable'): |
|
|
|
arguments = '0' |
|
|
|
|
|
|
|
if minute and hour and dayofweek and action: |
|
|
|
if minute and hour and days_of_week and action: |
|
|
|
if action == 'speedlimit': |
|
|
|
if not (arguments and arguments.isdigit()): |
|
|
|
action = '0' |
|
|
@ -1983,7 +1993,7 @@ class ConfigScheduling(object): |
|
|
|
if action: |
|
|
|
sched = cfg.schedules() |
|
|
|
sched.append('%s %s %s %s %s' % |
|
|
|
(minute, hour, dayofweek, action, arguments)) |
|
|
|
(minute, hour, days_of_week, action, arguments)) |
|
|
|
cfg.schedules.set(sched) |
|
|
|
|
|
|
|
config.save_config() |
|
|
|