-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
executable file
·81 lines (59 loc) · 1.83 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#! /usr/bin/python3
"""
# Run a local mail server for debug/testing
python -u -m smtpd -n -c DebuggingServer localhost:1025 | tee email.txt
"""
import os
import time
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django
django.setup()
start = datetime.datetime.now()
from backupz.models import *
import backupz.sync
sync = backupz.sync.Sync()
sync.all()
defaults = DefaultOption.objects.get()
#print('Defaults config file: ', defaults.config_file())
host = Host.objects.get(name='phys-solid')
jobs = Job.objects.filter(host=host)
to_run, not_run = Job.objects.to_run(start)
for j in to_run:
print('To Run: %s : %s' % (j, j.should_start(start)))
print()
for j in not_run:
print('Not run: %s : %s' % (j, j.should_start(start)))
print()
for j in jobs:
print("vvvvvvvvvv %s vvvvvvvvvv" % j)
print('config_file: ', j.host.config_file())
if j.host.backup_area:
print('area:config_file: ', j.host.backup_area.config_file())
print('fs_path: ', j.fs_path())
print('zfs_path: ', j.zfs_path())
print()
print('partial_okay: ', j.config.partial_okay)
print('frequency: ', j.config.frequency)
print('email_to: ', j.config.email_to)
print('email_from:', j.config.email_from)
print('allowed_days: ', j.config.allowed_days)
print('schedule: ', j.config.schedule)
print()
print('should_start: ', j.should_start(stamp=start))
print()
b = Backup(job=j, start=start)
print(b)
cli = b.cli()
print(cli[0])
for c in cli[1:]:
print(" ", c)
print()
print('Host backups: ', host.list_backups())
print('Job backups: ', j.list_backups())
print()
#time.sleep(1.6)
print('zfs.isfilesystem: ', zfs.isfilesystem.cache_info())
print('zfs.used: ', zfs.used.cache_info())
print('Job.seconds: ', Job.seconds_late.cache_info())
email.send()