mirror of
https://gitlab.sectorq.eu/jaydee/omv_backup.git
synced 2025-07-02 08:08:32 +02:00
added v3
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
now = datetime.datetime.now()
|
||||||
|
DATETIME = now.strftime("%Y%m%d%H%M%S")
|
||||||
print("Backup gitlab")
|
print("Backup gitlab")
|
||||||
cmnd = 'docker exec -t gitlab gitlab-backup create SKIP=artifacts,repositories,registry,uploads,builds,pages,lfs,packages,terraform_state'
|
cmnd = 'docker exec -t gitlab gitlab-backup create SKIP=artifacts,repositories,registry,uploads,builds,pages,lfs,packages,terraform_state'
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
@ -11,7 +14,7 @@ status, output = subprocess.getstatusoutput(cmnd)
|
|||||||
cmnd = "docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --off"
|
cmnd = "docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --off"
|
||||||
status, output = subprocess.getstatusoutput(cmnd)
|
status, output = subprocess.getstatusoutput(cmnd)
|
||||||
|
|
||||||
|
print("Backup portainer")
|
||||||
headers = {
|
headers = {
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
'x-api-key':'ptr_gfwpbP4AUDhZ4uoPmSfNUGqZq+gescoele8reP/l/GU=',
|
'x-api-key':'ptr_gfwpbP4AUDhZ4uoPmSfNUGqZq+gescoele8reP/l/GU=',
|
||||||
@ -28,5 +31,5 @@ response = requests.post('https://portainer.sectorq.eu/api/backup', headers=head
|
|||||||
#data = '{ "password": "" }'
|
#data = '{ "password": "" }'
|
||||||
#response = requests.post('https://portainer.sectorq.eu/api/backup', headers=headers, data=data, verify=False)
|
#response = requests.post('https://portainer.sectorq.eu/api/backup', headers=headers, data=data, verify=False)
|
||||||
|
|
||||||
with open('/share/docker_data/__backups/portainer_snapshot.tar.gz', 'wb') as f:
|
with open(f'/share/docker_data/__backups/portainer_snapshot_{DATETIME}.tar.gz', 'wb') as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
Reference in New Issue
Block a user