Merge branch 'v2.3.4-dev' of github.com:usmannasir/cyberpanel into v2.3.4-dev

This commit is contained in:
usman@cyberpersons.com
2023-02-20 15:28:23 +05:00
3 changed files with 48 additions and 6 deletions

View File

@@ -1,7 +1,11 @@
import time
import requests
# ts stores the time in seconds
ts = time.time()
url = "https://api.github.com/repos/rustic-rs/rustic/releases/latest" # Replace with your API endpoint URL
response = requests.get(url)
# print the current timestamp
print(ts)
if response.status_code == 200:
data = response.json()
print(data['tag_name'])
# Do something with the data
else:
print("Request failed with status code:", response.status_code)

View File

@@ -3,9 +3,14 @@ import json
import os
import sys
import time
import requests
sys.path.append('/usr/local/CyberCP')
import django
import plogical.CyberCPLogFileWriter as logging
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
try:
@@ -321,6 +326,37 @@ class CPBackupsV2:
return 1
def Incrmentalback(self):
try:
url = "https://api.github.com/repos/rustic-rs/rustic/releases/latest"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
version = data['tag_name']
name = data['name']
#wget -P /home/rustic https://github.com/rustic-rs/rustic/releases/download/v0.4.3/rustic-v0.4.3-x86_64-unknown-linux-gnu.tar.gz
#tar xzf /home/rustic/rustic-v0.4.3-x86_64-unknown-linux-gnu.tar.gz -C /home/rustic/
#sudo mv filename /usr/bin/
command = 'wget -P /home/rustic https://github.com/rustic-rs/rustic/releases/download/%s/rustic-%s-x86_64-unknown-linux-gnu.tar.gz' %(version, version)
ProcessUtilities.executioner(command)
command = 'tar xzf /home/rustic/rustic-%s-x86_64-unknown-linux-gnu.tar.gz -C /home/rustic//'%(version)
ProcessUtilities.executioner(command)
command = 'sudo mv /home/rustic/rustic /usr/bin/'
ProcessUtilities.executioner(command)
command = 'rm -rf /home/rustic'
ProcessUtilities.executioner(command)
except BaseException as msg:
print('Error: %s'%msg)
if __name__ == "__main__":
try:
parser = argparse.ArgumentParser(description='CyberPanel Backup Generator')
@@ -335,4 +371,5 @@ if __name__ == "__main__":
except:
cpbuv2 = CPBackupsV2({'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1, 'BackupEmails': 1} )
cpbuv2.InitiateBackup()
cpbuv2.InitiateBackup()
cpbuv2.Incrmentalback()

View File

@@ -455,6 +455,7 @@ def refreshLicense(request):
{'domain': 'cyberpanel.net', 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1,
'BackupEmails': 1})
cpbuv2.InitiateBackup()
cpbuv2.Incrmentalback()
final_dic = {'status': 1}
final_json = json.dumps(final_dic)