-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver-backup-script.py
24 lines (19 loc) · 1.05 KB
/
server-backup-script.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
#------------------------------------------------------------------------------------
# Developed by Carpathian, LLC - Open Source server backup script for MacMini
# Free for personal use only – for enterprise or business use, please email malkasian(a)dsm.studio
#---------------------------------------------------------------------------------------
__version__ = "1.0"
#--------------------------------------IMPORTS------------------------------------------
import os
import shutil
from datetime import datetime
#--------------------------------------VARIABLES------------------------------------------
server_directory = "PATH_TO_FOLDER(S)_YOU_WANT_TO_BACK_UP"
backup_folder = "LOCATION_YOU_WANT_TO_SAVE_BACKUP_TO"
def backup_server():
timestamp = datetime.now().strftime("%Y-%m-%d")
destination_folder = os.path.join(backup_folder, f"backup_{timestamp}")
shutil.copytree(server_directory, destination_folder)
shutil.make_archive(destination_folder, 'zip', destination_folder)
print(f"Backup completed to {destination_folder}.zip")
backup_server()