slight changes to adapt to new place

This commit is contained in:
jenz
2023-06-14 23:45:48 +02:00
parent 73be3c4904
commit 8542e72a2c
4 changed files with 76 additions and 441 deletions
+6 -11
View File
@@ -45,8 +45,8 @@ def load_config(config_file):
sys.exit(1)
def main():
#runs demos every 5 minutes but backups thrice a week with systemctl services/timers
config_file = 'config_demos.json'
#runs backups
config_file = 'config_backups.json'
if sys.argv[1:]:
config_file = sys.argv[1]
remotes, jobs, settings = load_config(config_file)
@@ -56,15 +56,9 @@ def main():
dest2 = create_remote(remotes[job["dest2"]], settings)
if index == 0:
#delete old files (not very adaptable, cant handle dirs in dirs)
dest.delete_remote_zips("/home/nonroot/backups")
dest2.delete_remote_zips("/home/autismbot5/compressed_backups")
if 'demo_' in job["job_name"]:
source_files = src.list_dir()
distribute_files(source_files, dest)
for pathfile in source_files:
src.delete_local_demo(pathfile)
dest.delete_remote_demos(source_files)
elif "backup_local" in job["job_name"]:
dest.delete_remote_zips("/home/nonroot/backups/")
dest2.delete_remote_zips("/home/autismbot5/backups/")
if "backup_local" in job["job_name"]:
zip_file_path = src.zip_local_directory(job)
if not dest.put(zip_file_path, dest.path):
log_msg = ''.join(["failed putting file: ", str(pathfile)])
@@ -120,3 +114,4 @@ def main():
if __name__ == '__main__':
main()