Last active
March 20, 2019 11:35
-
-
Save Disassembler0/b5627e459fdeb6d44b665a140a52cf1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import sys | |
| import time | |
| ### Configuration changes here ### | |
| BACKUP_DIR = "/tmp" | |
| if not AdminConfig.hasChanges(): | |
| print "No files were changed. Exiting." | |
| sys.exit(0) | |
| dmgr_profile_path = AdminTask.showVariables(["-scope", "Node="+AdminControl.getNode(), "-variableName", "USER_INSTALL_ROOT"]) | |
| if not dmgr_profile_path: | |
| print "Couldn't find Dmgr profile path. Exiting." | |
| sys.exit(1) | |
| changed_files = AdminConfig.queryChanges().splitlines()[1:] | |
| changed_files = [os.path.join(dmgr_profile_path, "config", f.strip()) for f in changed_files] | |
| tar_name = os.path.join(BACKUP_DIR, time.strftime("%Y-%m-%d_%H-%M-%S")+".tgz") | |
| os.system("tar czvf "+tar_name+" "+" ".join(changed_files)) | |
| AdminConfig.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment