Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encrypted dataset restore and make backup cron setting optional #68

Merged
merged 5 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion zfs_uploader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.8.0'
__version__ = '0.9.0'

BACKUP_DB_FILE = 'backup.db'
DATETIME_FORMAT = '%Y%m%d_%H%M%S'
20 changes: 14 additions & 6 deletions zfs_uploader/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ def cli(ctx, config_path, log_path):
@cli.command()
@click.pass_context
def backup(ctx):
""" Start backup job scheduler. """
""" Start backup job scheduler or runs the tasks serially if
rdelcorro marked this conversation as resolved.
Show resolved Hide resolved
cron is not provided in the config file
rdelcorro marked this conversation as resolved.
Show resolved Hide resolved
"""
config_path = ctx.obj['config_path']
logger = ctx.obj['logger']

Expand All @@ -57,13 +59,19 @@ def backup(ctx):
)

for job in config.jobs.values():
logger.info(f'filesystem={job.filesystem} '
f'cron="{job.cron}" '
'msg="Adding job."')
scheduler.add_job(job.start, 'cron', **job.cron, coalesce=True)
if job.cron:
rdelcorro marked this conversation as resolved.
Show resolved Hide resolved
logger.info(f'filesystem={job.filesystem} '
f'cron="{job.cron}" '
'msg="Adding job."')
scheduler.add_job(job.start, 'cron', **job.cron, coalesce=True)
else:
logger.info(f'filesystem={job.filesystem}'
'msg="Running job."')
job.start()

try:
scheduler.start()
if len(scheduler.get_jobs()) > 0:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
pass

Expand Down