mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-12-14 10:04:52 +01:00
build
This commit is contained in:
@@ -13,6 +13,7 @@ parser.add_argument("--bookstack", "-s", action="store_true", help="Select influ
|
||||
parser.add_argument("--influx", "-i", action="store_true", help="Select influx")
|
||||
parser.add_argument("--kestra", "-k", action="store_true", help="Select influx")
|
||||
parser.add_argument("--authentik", "-a", action="store_true", help="Select influx")
|
||||
parser.add_argument("--portainer", "-p", action="store_true", help="Select influx")
|
||||
parser.add_argument("--backup", "-b", action="store_true", help="Select backup mode")
|
||||
parser.add_argument("--all", "-A", action="store_true", help="Select backup mode")
|
||||
args = parser.parse_args()
|
||||
@@ -23,7 +24,7 @@ PASSWORD= "l4c1j4yd33Du5lo"
|
||||
DATETIME = now.strftime("%Y%m%d%H%M%S")
|
||||
os.chdir("/share/docker_data/__backups/")
|
||||
|
||||
if args.backup and args.gitlab:
|
||||
if args.backup and (args.gitlab or args.all):
|
||||
print("Backup gitlab")
|
||||
cmnd = 'docker exec -t gitlab gitlab-backup create SKIP=artifacts,repositories,registry,uploads,builds,pages,lfs,packages,terraform_state'
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
@@ -33,7 +34,7 @@ if args.backup and args.gitlab:
|
||||
|
||||
|
||||
|
||||
if args.backup and args.nextcloud:
|
||||
if args.backup and (args.nextcloud or args.all):
|
||||
print("Backup nextcloud")
|
||||
cmnd = 'docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --on'
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
@@ -44,35 +45,35 @@ if args.backup and args.nextcloud:
|
||||
cmnd = f"zip -P {PASSWORD} nextcloudDB_{DATETIME}.sql.zip nextcloudDB_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
os.remove(f"nextcloudDB_{DATETIME}.sql")
|
||||
if args.backup and args.bookstack:
|
||||
if args.backup and (args.bookstack or args.all):
|
||||
print("Backup Bookstack")
|
||||
cmnd = f"docker exec bookstack-db-1 sh -c 'exec mysqldump --single-transaction -h localhost -u bookstack -p{PASSWORD} bookstackapp' > /share/docker_data/__backups/bookstack_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
cmnd = f"zip -P {PASSWORD} bookstack_{DATETIME}.sql.zip bookstack_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
os.remove(f"bookstack_{DATETIME}.sql")
|
||||
if args.backup and args.kestra:
|
||||
if args.backup and (args.kestra or args.all):
|
||||
print("Backup Kestra")
|
||||
cmnd = f"docker exec kestra-postgres-1 sh -c 'pg_dump -h localhost -p 5432 -U kestra -d kestra' > /share/docker_data/__backups/kestra_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
cmnd = f"zip -P {PASSWORD} kestra_{DATETIME}.sql.zip kestra_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
os.remove(f"kestra_{DATETIME}.sql")
|
||||
if args.backup and args.authentik:
|
||||
if args.backup and (args.authentik or args.all):
|
||||
print("Backup Authentik")
|
||||
cmnd = f"docker exec authentik-postgresql-1 sh -c 'pg_dump -h localhost -p 5432 -U authentik -d authentik' > /share/docker_data/__backups/authentik_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
cmnd = f"zip -P {PASSWORD} authentik_{DATETIME}.sql.zip authentik_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
os.remove(f"authentik_{DATETIME}.sql")
|
||||
if args.backup and args.zabbix:
|
||||
if args.backup and (args.zabbix or args.all):
|
||||
print("Backup Zabbix")
|
||||
cmnd = f"docker exec zabbix-server-db-server-1 sh -c 'pg_dump -h localhost -p 5432 -U zabbix -d zabbix' > /share/docker_data/__backups/zabbix_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
cmnd = f"zip -P {PASSWORD} zabbix_{DATETIME}.sql.zip zabbix_{DATETIME}.sql"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
os.remove(f"zabbix_{DATETIME}.sql")
|
||||
if args.backup and args.influx:
|
||||
if args.backup and (args.influx or args.all):
|
||||
print("Backup Influx")
|
||||
cmnd = f"docker exec home-assistant-influxdb-1 influx backup /backup"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
@@ -83,7 +84,7 @@ if args.backup and args.influx:
|
||||
cmnd = f"zip -P {PASSWORD} influxdb_{DATETIME}.zip /tmp/backup_{DATETIME}"
|
||||
status, output = subprocess.getstatusoutput(cmnd)
|
||||
print(output)
|
||||
if args.backup and args.portainer:
|
||||
if args.backup and (args.portainer or args.all):
|
||||
print("Backup portainer")
|
||||
headers = {
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
|
||||
Reference in New Issue
Block a user