Ejemplo n.º 1
0
Archivo: MS.py Proyecto: rkupv/MoveSite
output = stdout.read()
archivename = output.decode("utf-8")

# Get file if needed
restoredir = os.path.normpath(place + '/' + archivename)
restoreto = os.path.normpath(place + '/' + site)

if not os.path.exists(restoredir):
    print('Fetching archive ...')
    msu.getremote(backupsdir + '/' + archivename, restoredir)
else:
    print('Archive exists')

#       Assure that MySQL is active
while True:
    (exitcode, stdout, stderr) = msu.localcommand(['tasklist', '/nh', '/fi', "IMAGENAME eq mysqld.exe"])
    s = stdout.decode("utf-8")
    if s[0:5] == "INFO:":
        print('Please start MySQL from XAMPP Control Panel')
        print('Type RETURN when done')
        input()
    else: break

print('Calling Drush ...')
(exitcode, stdout, stderr) = msu.localcommand([drush, "-v",
                 "archive-restore", restoredir,
                 "--destination=" + restoreto,
                 "--overwrite",
                 "--db-su=" + mysqluser,
                 "--db-su-pw=" + mysqlpw])
Ejemplo n.º 2
0
# Get file if needed
restoredir = os.path.normpath(place + '/' + archivename)
restoreto = os.path.normpath(place + '/' + site)

if not os.path.exists(restoredir):
    print('Fetching archive ...')
    msu.getremote(backupsdir + '/' + archivename, restoredir)
else:
    print('Archive exists')

print('Calling Drush ...')

msu.localcommand([drush,\
'archive-restore', restoredir,\
'--destination=' + restoreto,\
'--overwrite',\
'--db-su=' + mysqluser,\
'--db-su-pw=' + mysqlpw])

# Set owner and mode
msu.localcommand(['sudo','chown','-R', usergroup, place])
msu.localcommand(['sudo','chmod','-R','0770',place])