Skip to content
Permalink
Browse files

bug fix: incremental backups and upgrade process

  • Loading branch information
usmannasir committed Oct 19, 2019
1 parent 8c706c0 commit 9863207b197547b78f0142d8a5216723e7ff9a98
Showing with 383 additions and 143 deletions.
  1. +358 −128 .idea/workspace.xml
  2. +10 −5 IncBackups/views.py
  3. +2 −2 install/install.py
  4. +4 −8 plogical/upgrade.py
  5. +9 −0 preUpgrade.sh
  6. 0 serverLogs/views.py

Large diffs are not rendered by default.

@@ -16,6 +16,7 @@
import time
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
from loginSystem.views import loadLoginPage
import stat
# Create your views here.


@@ -117,13 +118,15 @@ def addDestination(request):
tmpFile = '/home/cyberpanel/sshconfig'

writeToFile = open(tmpFile, 'w')
writeToFile.write(currentConfig)
if currentConfig.find('cat') == -1:
writeToFile.write(currentConfig)

content = """Host %s
IdentityFile ~/.ssh/cyberpanel
Port %s
""" % (ipAddress, port)
writeToFile.write(content)
IdentityFile ~/.ssh/cyberpanel
Port %s
""" % (ipAddress, port)
if currentConfig.find(ipAddress) == -1:
writeToFile.write(content)
writeToFile.close()


@@ -159,6 +162,8 @@ def addDestination(request):
writeToFile.write(AWS_SECRET_ACCESS_KEY)
writeToFile.close()

os.chmod(awsFile, stat.S_IRUSR | stat.S_IWUSR)

final_dic = {'status': 1}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
@@ -3721,12 +3721,12 @@ def installRestic(self):
data = open(cronTab, 'r').read()

if data.find('IncScheduler') == -1:
cronJob = '0 12 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily'
cronJob = '0 12 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily\n'

writeToFile = open(cronTab, 'a')
writeToFile.writelines(cronJob)

cronJob = '0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily'
cronJob = '0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily\n'
writeToFile.writelines(cronJob)
writeToFile.close()

@@ -435,10 +435,10 @@ def setupVirtualEnv():
##

command = "pip install --ignore-installed -r /usr/local/CyberCP/requirments.txt"
Upgrade.executioner(command, 'CyberPanel requirements', 1)
Upgrade.executioner(command, 'CyberPanel requirements', 0)

command = "virtualenv --system-site-packages /usr/local/CyberCP"
Upgrade.executioner(command, 'Setting up VirtualEnv [Two]', 1)
Upgrade.executioner(command, 'Setting up VirtualEnv [Two]', 0)

Upgrade.stdOut('Virtual enviroment for CyberPanel successfully installed.')
except OSError, msg:
@@ -1276,9 +1276,6 @@ def downloadAndUpgrade(versionNumbring):

Upgrade.stdOut("Settings file backed up.")

if os.path.exists('/usr/local/CyberCP/bin'):
shutil.rmtree('/usr/local/CyberCP/bin')

## Extract Latest files

# command = "tar zxf CyberPanel.1.7.4.tar.gz"
@@ -1617,7 +1614,6 @@ def installPHP73():
command = 'cp /usr/local/lsws/lsphp71/bin/php /usr/bin/'
Upgrade.executioner(command, 'Set default PHP 7.0, 0')


@staticmethod
def someDirectories():
command = "mkdir -p /usr/local/lscpd/admin/"
@@ -1838,12 +1834,12 @@ def installRestic():
data = open(cronTab, 'r').read()

if data.find('IncScheduler') == -1:
cronJob = '0 12 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily'
cronJob = '0 12 * * * root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily\n'

writeToFile = open(cronTab, 'a')
writeToFile.writelines(cronJob)

cronJob = '0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily'
cronJob = '0 0 * * 0 root /usr/local/CyberCP/bin/python2 /usr/local/CyberCP/IncBackups/IncScheduler.py Daily\n'
writeToFile.writelines(cronJob)
writeToFile.close()

@@ -0,0 +1,9 @@
if [ ! -d "/usr/local/CyberPanel" ]; then
virtualenv --system-site-packages /usr/local/CyberPanel
source /usr/local/CyberPanel/bin/activate
rm -rf requirments.txt
wget https://raw.githubusercontent.com/usmannasir/cyberpanel/1.8.0/requirments.txt
pip install --ignore-installed -r requirments.txt
virtualenv --system-site-packages /usr/local/CyberPanel
fi

0 serverLogs/views.py 100644 → 100755
No changes.

0 comments on commit 9863207

Please sign in to comment.
You can’t perform that action at this time.