Index

s3-bsync / 0fae871

Bidirectional syncing tool to sync local filesystem directories with S3 buckets. (Incomplete)

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
1316 Jun 2022 21:050fae871Update serialized data handlersJosh Stockin1121G

Blob @ s3-bsync / src / run.py

application/x-python1092 bytesdownload raw
1# s3-bsync Copyright (c) 2022 Joshua Stockin
2# <https://joshstock.in>
3# <https://git.joshstock.in/s3-bsync>
4#
5# This software is licensed and distributed under the terms of the MIT License.
6# See the MIT License in the LICENSE file of this project's root folder.
7#
8# This comment block and its contents, including this disclaimer, MUST be
9# preserved in all copies or distributions of this software's source.
10
11import logging
12
13from . import *
14
15logger = logging.getLogger(__name__)
16
17__all__ = ["run"]
18
19
20def run(settings):
21 logger.debug("Entering run sequence")
22 state = syncfile.syncfile(settings.syncfile)
23 if "PURGE" in settings.mode:
24 logger.debug("Purging syncfile")
25 state.purge()
26 logger.debug("Success. Exiting...")
27 exit(0)
28 if state.file_exists() and not "OVERWRITE" in settings.mode:
29 logger.debug("Syncfile exists. Deserializing...")
30 state.deserialize()
31 if not state.file_exists() and not "INIT" in settings.mode:
32 logger.error("Not in INIT mode and state file is nonexistent.")
33 exit(1)
34 state.serialize()
35