| 1 | /*-------------------------commandline.cpp------------------------------------------ |
| 2 | runs luckybackup in command line mode |
| 3 | |
| 4 | =============================================================================================================================== |
| 5 | =============================================================================================================================== |
| 6 | This file is part of "luckyBackup" project |
| 7 | Copyright, Loukas Avgeriou |
| 8 | luckyBackup is distributed under the terms of the GNU General Public License |
| 9 | luckyBackup is free software: you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation, either version 3 of the License, or |
| 12 | (at your option) any later version. |
| 13 | |
| 14 | luckyBackup is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with luckyBackup. If not,see <http://www.gnu.org/licenses/>. |
| 21 | developer : luckyb |
| 22 | last modified : 22 May 2016 |
| 23 | =============================================================================================================================== |
| 24 | =============================================================================================================================== |
| 25 | */ |
| 26 | |
| 27 | //#include "luckybackupwindow.cpp" |
| 28 | #include "commandline.h"cxx . . $ `<file>/src/commandline.h`/ |
| 29 | |
| 30 | #include <QProcess> |
| 31 | #include <QTextStream> |
| 32 | |
| 33 | #include "global.h"cxx . . $ `<file>/src/global.h`/ |
| 34 | #include "operationClass.h"cxx . . $ `<file>/src/operationClass.h`/ |
| 35 | |
| 36 | // class commandline Constructor================================================================================================= |
| 37 | commandlinecxx . . $ commandline#::commandlinecxx . . $ commandline#commandline(49f6e7a06ebc5aa8).() |
| 38 | { |
| 39 | writeToLogcxx . . $ Global/writeToLog.=false; |
| 40 | errorsFoundcxx . . $ Global/errorsFound. = 0; // Total number of errors from all tasks (in CLI, only 1 error per task is allowed !!) |
| 41 | filesTransferedcxx . . $ Global/filesTransfered. = 0; //total bytes transfered during profile execution |
| 42 | bytesTransferedcxx . . $ Global/bytesTransfered. = 0; //total bytes transfered during profile execution |
| 43 | errorCountcxx . . $ commandline#errorCount. = 0; // Number of errors from one task (max value is 1) |
| 44 | } |
| 45 | |
| 46 | // class commandline Destructor================================================================================================= |
| 47 | commandlinecxx . . $ commandline#::~cxx . . $ commandline#`~commandline`(ced63f7c635d850d).commandlinecxx . . $ commandline#() |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | // result=================================================================================================================== |
| 52 | // calls functions intro, loadProfile, check_list, check_dirs, rsyncIT, thats_all and returns an integer to main() |
| 53 | int commandlinecxx . . $ commandline#::resultcxx . . $ commandline#result(b126dc7c1de90089).() |
| 54 | { |
| 55 | introcxx . . $ commandline#intro(49f6e7a06ebc5aa8).(); |
| 56 | |
| 57 | rsyncITcxx . . $ commandline#rsyncIT(49f6e7a06ebc5aa8).(); |
| 58 | thats_allcxx . . $ commandline#thats_all(49f6e7a06ebc5aa8).(); |
| 59 | |
| 60 | if (errorsFoundcxx . . $ Global/errorsFound. > 0) |
| 61 | return 6; // error at rsync or pre/post command execution |
| 62 | |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | // intro=================================================================================================================== |
| 67 | // displays an intro message |
| 68 | void commandlinecxx . . $ commandline#::introcxx . . $ commandline#intro(49f6e7a06ebc5aa8).() |
| 69 | { |
| 70 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n============================================================================================\n"; |
| 71 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " luckybackup version "; |
| 72 | coutcxx . . $ std/cout. <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). appVersioncxx . . $ Global/appVersion.; |
| 73 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " - command line mode \n"; |
| 74 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"; |
| 75 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "This application will (hopefully) sync and backup everything you need in no time\n"; |
| 76 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "(Well, it might take a little longer if run for the first time ;-)\n\n"; |
| 77 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 78 | if (!NoQuestionscxx . . $ Global/NoQuestions.) //if questions are required |
| 79 | { |
| 80 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Make sure that:\n"; |
| 81 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "You have already declared and mounted all the directories that need to be synced/backed-up\n"; |
| 82 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Please take a moment to examine all messages from checks done until now\n\n"; |
| 83 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Also have in mind that, to avoid errors, it is best to run this app as su\n\n"; |
| 84 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Hit 'enter' to continue otherwise press 'ctrl+c' to exit NOW\n"; |
| 85 | cincxx . . $ std/cin..getcxx . . $ std/basic_istream#get(3a3be259693afdc2).(); |
| 86 | } |
| 87 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n"; |
| 88 | } |
| 89 | |
| 90 | |
| 91 | |
| 92 | // rsyncIT=================================================================================================================== |
| 93 | // Performs the execution of operations |
| 94 | void commandlinecxx . . $ commandline#::rsyncITcxx . . $ commandline#rsyncIT(49f6e7a06ebc5aa8).() |
| 95 | { |
| 96 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n============================================================================================\n"; |
| 97 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Executing tasks"; |
| 98 | if (DryRuncxx . . $ Global/DryRun.) |
| 99 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " (simulation mode)"; |
| 100 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n"; |
| 101 | |
| 102 | //some useful variables----------------------------------------------------------------------- |
| 103 | QProcesscxx . . $ QProcess# *syncProcess; syncProcess = new QProcesscxx . . $ QProcess#; //create a new qprocess (for rsync) |
| 104 | QStringcxx . . $ QString# command = rsyncCommandPathcxx . . $ QString#QString(132dd6869045752b).; //command to be executed. Normally this is "rsync" |
| 105 | QStringcxx . . $ QString# command2=""cxx . . $ QString#QString(85c52e162fed56f9).; // windows use |
| 106 | QStringListcxx . . $ QStringList# rsyncArgumentscxx . . $ QStringList#QStringList(ced63f7c635d850d).; // This stringList holds all arguments for the rsync command |
| 107 | QStringcxx . . $ QString# dirAcxx . . $ QString#QString(ced63f7c635d850d).; //holds the first dir to be synced |
| 108 | QStringcxx . . $ QString# dirBcxx . . $ QString#QString(ced63f7c635d850d).; //holds the second dir to be synced |
| 109 | QStringcxx . . $ QString# logText=""cxx . . $ QString#QString(85c52e162fed56f9).; //This text will be appended to the logfile |
| 110 | |
| 111 | currentOperationcxx . . $ Global/currentOperation. = 0; |
| 112 | |
| 113 | while (currentOperationcxx . . $ Global/currentOperation. < TotalOperationscxx . . $ Global/TotalOperations.) |
| 114 | { |
| 115 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 116 | { |
| 117 | setAppDircxx . . $ Global/setAppDir(7df51288a9ebd664).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetLuckyBackupDircxx . . $ operation#GetLuckyBackupDir(4365c3963150523e).()); |
| 118 | /* disable vss until... |
| 119 | pipeVssFile = new QFile(Operation[currentOperation] -> GetTempPath()+SLASH+"qt_tempvss"+QString::number(qrand() % (999998) + 1)); |
| 120 | if (pipeVssFile->open(QIODevice::ReadWrite)){ |
| 121 | pipeVssFile->close(); |
| 122 | } |
| 123 | pipeVssErrFile = new QFile(Operation[currentOperation] -> GetTempPath()+SLASH+"qt_tempvsserr"+QString::number(qrand() % (999998) + 1)); |
| 124 | if (pipeVssErrFile->open(QIODevice::ReadWrite)){ |
| 125 | pipeVssErrFile->close(); |
| 126 | }*/ |
| 127 | } |
| 128 | |
| 129 | //if --skip-critical is given as argument and the task is CRITICAL |
| 130 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetCRITICALcxx . . $ operation#GetCRITICAL(50ce9a9e25b4a850).()) && (SkipCriticalcxx . . $ Global/SkipCritical.) ) |
| 131 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> SetPerformcxx . . $ operation#SetPerform(b45ddcbc8423892c).(false); //don't perform this operation |
| 132 | |
| 133 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetPerformcxx . . $ operation#GetPerform(50ce9a9e25b4a850).()) || (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetByPassWARNINGcxx . . $ operation#GetByPassWARNING(50ce9a9e25b4a850).()) ) |
| 134 | { |
| 135 | bool RemoteDestUsed = (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteDestinationcxx . . $ operation#GetRemoteDestination(50ce9a9e25b4a850).()) && (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemotecxx . . $ operation#GetRemote(50ce9a9e25b4a850).()); |
| 136 | |
| 137 | // SNAPSHOTS REMOVAL - This is outside the (currentSnaps >= maxSnaps) condition, because it will eventually cause the snapshots directory to get created so that the profile will be backed up without problems later on |
| 138 | // First calculate the folder where snapshots go |
| 139 | QStringListcxx . . $ QStringList# tempArguments = Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetArgscxx . . $ operation#GetArgs(e1dbd5c4feadc8f5).(); |
| 140 | QStringcxx . . $ QString# tempSource = tempArgumentscxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).tempArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-2]; |
| 141 | QStringcxx . . $ QString# tempDestination = tempArgumentscxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).tempArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-1]; |
| 142 | QStringcxx . . $ QString# tempDestinationOrig = tempArgumentscxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).tempArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-1]; //windows use |
| 143 | QStringcxx . . $ QString# tempDestinationOrig2cxx . . $ QString#QString(ced63f7c635d850d).; |
| 144 | QStringcxx . . $ QString# sourceLast = tempSourcecxx . . $ QString#QString(132dd6869045752b).; |
| 145 | |
| 146 | // win stuff ~~~~~ |
| 147 | QStringcxx . . $ QString# tslashcxx . . $ QString#QString(ced63f7c635d850d).; |
| 148 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 149 | tslash=cxx . . $ QString#`operator=`(b79fde0b0ce9b948).XnixSLASHcxx . . $ Global/XnixSLASH.; |
| 150 | else |
| 151 | tslash=cxx . . $ QString#`operator=`(b79fde0b0ce9b948).SLASHcxx . . $ Global/SLASH.; |
| 152 | |
| 153 | if (!tempSource.endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).(SLASHcxx . . $ Global/SLASH.)) // this means task is of type "backup dir by name" |
| 154 | { |
| 155 | sourceLast =cxx . . $ QString#`operator=`(4f35bf974e7f8568). calculateLastPathcxx . . $ Global/calculateLastPath(f7f320d754b8fd09).(sourceLastcxx . . $ QString#QString(132dd6869045752b).); // This is the lowest dir of the source |
| 156 | |
| 157 | tempSource.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(SLASHcxx . . $ Global/SLASH.); |
| 158 | |
| 159 | if (WINrunningcxx . . $ Global/WINrunning. && RemoteDestUsed) |
| 160 | tempDestination.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(sourceLast +cxx . . $ operator+(fab9b4f80031f353). XnixSLASHcxx . . $ Global/XnixSLASH.); |
| 161 | else |
| 162 | tempDestination.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(sourceLast +cxx . . $ operator+(fab9b4f80031f353). SLASHcxx . . $ Global/SLASH.); |
| 163 | } |
| 164 | |
| 165 | tempDestinationOrig2=cxx . . $ QString#`operator=`(b79fde0b0ce9b948).tempDestination; |
| 166 | if (RemoteDestUsed && WINrunningcxx . . $ Global/WINrunning.) |
| 167 | tempDestination.appendcxx . . $ QString#append(6a89d0b7f4d2681c). (snapDefaultDircxx . . $ Global/snapDefaultDir..replacecxx . . $ QString#replace(192e628656427d1c).(SLASHcxx . . $ Global/SLASH.,XnixSLASHcxx . . $ Global/XnixSLASH.)); |
| 168 | else |
| 169 | tempDestination.appendcxx . . $ QString#append(6a89d0b7f4d2681c). (snapDefaultDircxx . . $ Global/snapDefaultDir.); |
| 170 | |
| 171 | QStringListcxx . . $ QStringList# remoteArgscxx . . $ QStringList#QStringList(ced63f7c635d850d).; remoteArgs.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 172 | //all remote arguments exactly as used at normal backup |
| 173 | if (RemoteDestUsed) |
| 174 | { |
| 175 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("--protect-args"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 176 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.]-> GetRemoteModulecxx . . $ operation#GetRemoteModule(50ce9a9e25b4a850).()) && (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemotePasswordcxx . . $ operation#GetRemotePassword(6ef7b6c27b00b43d).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "") ) |
| 177 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("--password-file=" +cxx . . $ operator+(c75c3ae4eb9af1a8). ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemotePasswordcxx . . $ operation#GetRemotePassword(6ef7b6c27b00b43d).()) ); |
| 178 | if ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHcxx . . $ operation#GetRemoteSSH(50ce9a9e25b4a850).()) |
| 179 | { |
| 180 | QStringcxx . . $ QString# sshOptions=(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHOptionscxx . . $ operation#GetRemoteSSHOptions(6ef7b6c27b00b43d).()).replacecxx . . $ QString#replace(192e628656427d1c).("\""cxx . . $ QString#QString(85c52e162fed56f9).,"\\\""cxx . . $ QString#QString(85c52e162fed56f9).)+cxx . . $ operator+(3d22f08efddf8107)." -o \"StrictHostKeyChecking no\" -o \"PasswordAuthentication no\" "; |
| 181 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 182 | { |
| 183 | if ( |
| 184 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPasswordcxx . . $ operation#GetRemoteSSHPassword(6ef7b6c27b00b43d).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "") |
| 185 | if ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).() != 0) |
| 186 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e \""+cxx . . $ operator+(c75c3ae4eb9af1a8).Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSshCommandcxx . . $ operation#GetSshCommand(6ef7b6c27b00b43d).()+cxx . . $ operator+(3d22f08efddf8107)."\" "+cxx . . $ operator+(fab9b4f80031f353).sshOptions+cxx . . $ operator+(3d22f08efddf8107)." -i \"" +cxx . . $ operator+(fab9b4f80031f353). Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPasswordcxx . . $ operation#GetRemoteSSHPassword(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "\" -p " +cxx . . $ operator+(fab9b4f80031f353). |
| 187 | countStrcxx . . $ Global/countStr..setNumcxx . . $ QString#setNum(6483560ce2afa901).( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).()) ); |
| 188 | else |
| 189 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e \""+cxx . . $ operator+(c75c3ae4eb9af1a8).Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSshCommandcxx . . $ operation#GetSshCommand(6ef7b6c27b00b43d).()+cxx . . $ operator+(3d22f08efddf8107)."\" "+cxx . . $ operator+(fab9b4f80031f353).sshOptions+cxx . . $ operator+(3d22f08efddf8107)." -i \"" +cxx . . $ operator+(fab9b4f80031f353). Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPasswordcxx . . $ operation#GetRemoteSSHPassword(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "\""); |
| 190 | else |
| 191 | if ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).() != 0) |
| 192 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e \""+cxx . . $ operator+(c75c3ae4eb9af1a8).Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSshCommandcxx . . $ operation#GetSshCommand(6ef7b6c27b00b43d).()+cxx . . $ operator+(3d22f08efddf8107)."\" "+cxx . . $ operator+(fab9b4f80031f353).sshOptions+cxx . . $ operator+(3d22f08efddf8107)." -p " +cxx . . $ operator+(fab9b4f80031f353). countStrcxx . . $ Global/countStr..setNumcxx . . $ QString#setNum(6483560ce2afa901).( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).()) ); |
| 193 | else |
| 194 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e \""+cxx . . $ operator+(c75c3ae4eb9af1a8).Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSshCommandcxx . . $ operation#GetSshCommand(6ef7b6c27b00b43d).()+cxx . . $ operator+(3d22f08efddf8107)."\" "+cxx . . $ operator+(fab9b4f80031f353).sshOptions+cxx . . $ operator+(3d22f08efddf8107).""); |
| 195 | } |
| 196 | else |
| 197 | { |
| 198 | if ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPasswordcxx . . $ operation#GetRemoteSSHPassword(6ef7b6c27b00b43d).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "") |
| 199 | if ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).() != 0) |
| 200 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e "+cxx . . $ operator+(c75c3ae4eb9af1a8).sshCommandPathcxx . . $ Global/sshCommandPath.+cxx . . $ operator+(3d22f08efddf8107)." -i " +cxx . . $ operator+(fab9b4f80031f353). Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPasswordcxx . . $ operation#GetRemoteSSHPassword(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107)." -p " +cxx . . $ operator+(fab9b4f80031f353). |
| 201 | countStrcxx . . $ Global/countStr..setNumcxx . . $ QString#setNum(6483560ce2afa901).( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).()) ); |
| 202 | else |
| 203 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e "+cxx . . $ operator+(c75c3ae4eb9af1a8).sshCommandPathcxx . . $ Global/sshCommandPath.+cxx . . $ operator+(3d22f08efddf8107)." -i " +cxx . . $ operator+(fab9b4f80031f353). Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPasswordcxx . . $ operation#GetRemoteSSHPassword(6ef7b6c27b00b43d).()); |
| 204 | else |
| 205 | if ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).() != 0) |
| 206 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e "+cxx . . $ operator+(c75c3ae4eb9af1a8).sshCommandPathcxx . . $ Global/sshCommandPath.+cxx . . $ operator+(3d22f08efddf8107)." -p " +cxx . . $ operator+(fab9b4f80031f353). countStrcxx . . $ Global/countStr..setNumcxx . . $ QString#setNum(6483560ce2afa901).( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRemoteSSHPortcxx . . $ operation#GetRemoteSSHPort(455f465bc33b4cdf).()) ); |
| 207 | else |
| 208 | remoteArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("-e "+cxx . . $ operator+(c75c3ae4eb9af1a8).sshCommandPathcxx . . $ Global/sshCommandPath.); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | //update the last execution time + logfile actions ~~~~~~~~~~~~~~~~~~~~~ |
| 214 | if (!DryRuncxx . . $ Global/DryRun.) |
| 215 | { |
| 216 | int maxSnaps = Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetKeepSnapshotscxx . . $ operation#GetKeepSnapshots(455f465bc33b4cdf).(); // this is the number of snapshots to keep |
| 217 | if (maxSnaps < 1) |
| 218 | maxSnaps = 1; |
| 219 | int currentSnaps = Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListSizecxx . . $ operation#GetSnapshotsListSize(455f465bc33b4cdf).(); // this is the current number of snapshots |
| 220 | if (currentSnaps < 1) |
| 221 | currentSnaps = 1; |
| 222 | |
| 223 | // Juan's patch ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 224 | // this is just to create the .snapDefaultDir if it does not to exist so as to copy profile data later... |
| 225 | |
| 226 | //we will create the snapshots default directory by using an rsync command with an empty source without --delete option |
| 227 | QProcesscxx . . $ QProcess# *mkdirProcess; mkdirProcess = new QProcesscxx . . $ QProcess#; |
| 228 | QStringListcxx . . $ QStringList# mkdirArgscxx . . $ QStringList#QStringList(ced63f7c635d850d).; mkdirArgs.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 229 | |
| 230 | //if (WINrunning && RemoteDestUsed) |
| 231 | // mkdirArgs << "--mkdir"; |
| 232 | //else |
| 233 | mkdirArgs <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "--progress"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "-r"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 234 | //add all remote arguments exactly as used at normal backup |
| 235 | if (RemoteDestUsed) |
| 236 | mkdirArgs <<cxx . . $ QStringList#`operator<<`(cb3c3d1614140851). remoteArgs; |
| 237 | |
| 238 | // Add the destination folder |
| 239 | mkdirArgs.appendcxx . . $ QList#append(77d9f17553126ecb).(snapEmptyDircxx . . $ Global/snapEmptyDir.); |
| 240 | mkdirArgs.appendcxx . . $ QList#append(77d9f17553126ecb).(tempDestinationOrig); |
| 241 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 242 | { |
| 243 | //bool createWinRsyncCommand(tempDirPath,QFile command1,QFile command2,bool vss,QString rsyncArgs,QString source,QString dest); |
| 244 | command2=cxx . . $ QString#`operator=`(4f35bf974e7f8568).createWinRsyncCommandcxx . . $ Global/createWinRsyncCommand(f72b83e3d8c9da9d).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTempPathcxx . . $ operation#GetTempPath(6ef7b6c27b00b43d).(),false,mkdirArgs,false); |
| 245 | if (command2==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."") |
| 246 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to create bat file in mkdirProccess"; |
| 247 | else |
| 248 | mkdirProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (command2); |
| 249 | } |
| 250 | else |
| 251 | mkdirProcess -> startcxx . . $ QProcess#start(5e315ba9c811784d). (command,mkdirArgs); |
| 252 | mkdirProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(); |
| 253 | |
| 254 | if ((mkdirProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()) == 0) |
| 255 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n!"; |
| 256 | else |
| 257 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n!mkdir error!"; |
| 258 | |
| 259 | // Add the destination folder [ + sourceLast +SLASH ] |
| 260 | mkdirArgs.removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).(); |
| 261 | mkdirArgs.appendcxx . . $ QList#append(77d9f17553126ecb).(tempDestinationOrig2); |
| 262 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 263 | { |
| 264 | //bool createWinRsyncCommand(tempDirPath,QFile command1,QFile command2,bool vss,QString rsyncArgs,QString source,QString dest); |
| 265 | command2=cxx . . $ QString#`operator=`(4f35bf974e7f8568).createWinRsyncCommandcxx . . $ Global/createWinRsyncCommand(f72b83e3d8c9da9d).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTempPathcxx . . $ operation#GetTempPath(6ef7b6c27b00b43d).(),false,mkdirArgs,false); |
| 266 | if (command2==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."") |
| 267 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to create bat file in mkdirProccess"; |
| 268 | else |
| 269 | mkdirProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (command2); |
| 270 | } |
| 271 | else |
| 272 | mkdirProcess -> startcxx . . $ QProcess#start(5e315ba9c811784d). (command,mkdirArgs); |
| 273 | mkdirProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(); |
| 274 | |
| 275 | if ((mkdirProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()) == 0) |
| 276 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n!"; |
| 277 | else |
| 278 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n!mkdir error!"; |
| 279 | |
| 280 | // Add the destination folder [ + sourceLast +SLASH ] + snapDefaultDir |
| 281 | mkdirArgs.removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).(); |
| 282 | mkdirArgs.appendcxx . . $ QList#append(77d9f17553126ecb).(tempDestination); |
| 283 | // QTemporaryFile command1(QDir::tempPath()+"\\qt_tempXXXXXX.bat"); |
| 284 | // QTemporaryFile command2(QDir::tempPath()+"\\qt_tempXXXXXX.bat"); |
| 285 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 286 | { |
| 287 | //bool createWinRsyncCommand(tempDirPath,QFile command1,QFile command2,bool vss,QString rsyncArgs,QString source,QString dest); |
| 288 | command2=cxx . . $ QString#`operator=`(4f35bf974e7f8568).createWinRsyncCommandcxx . . $ Global/createWinRsyncCommand(f72b83e3d8c9da9d).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTempPathcxx . . $ operation#GetTempPath(6ef7b6c27b00b43d).(),false,mkdirArgs,false); |
| 289 | if (command2==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."") |
| 290 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to create bat file in rmProccess"; |
| 291 | else |
| 292 | mkdirProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (command2); |
| 293 | } |
| 294 | else |
| 295 | mkdirProcess -> startcxx . . $ QProcess#start(5e315ba9c811784d). (command,mkdirArgs); |
| 296 | mkdirProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(); |
| 297 | |
| 298 | if ((mkdirProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()) == 0) |
| 299 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n!"; |
| 300 | else |
| 301 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n!mkdir error!"; |
| 302 | // Juan's patch END~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 303 | |
| 304 | // first remove the older logfiles and snapshots if max keep snapshots is reached |
| 305 | if (currentSnaps >= maxSnaps) |
| 306 | { |
| 307 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 308 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Removing old snapshots and logfiles of task: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). |
| 309 | QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetNamecxx . . $ operation#GetName(6ef7b6c27b00b43d).()).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 310 | |
| 311 | // ************** actually REMOVE DATA of all older snapshots *************************** |
| 312 | // ****************************************************************************** |
| 313 | |
| 314 | |
| 315 | // increase the remove limit to include the source.size() if "backup dir by name" is used |
| 316 | if (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTypeDirNamecxx . . $ operation#GetTypeDirName(50ce9a9e25b4a850).()) |
| 317 | removeCharLimitcxx . . $ Global/removeCharLimit. = 4 + sourceLast.sizecxx . . $ QString#size(455f465bc33b4cdf).()+1; |
| 318 | else |
| 319 | removeCharLimitcxx . . $ Global/removeCharLimit. = 4; |
| 320 | |
| 321 | QProcesscxx . . $ QProcess# *rmProcess; rmProcess = new QProcesscxx . . $ QProcess#; |
| 322 | QStringListcxx . . $ QStringList# rmArgscxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 323 | rmArgs <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "--progress"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "-r"cxx . . $ QString#QString(85c52e162fed56f9). <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "--delete-after"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 324 | int snapToKeep = currentSnaps-maxSnaps + 1; |
| 325 | while ( snapToKeep < currentSnaps ) |
| 326 | { |
| 327 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 328 | rmArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("--filter=protect " +cxx . . $ operator+(c75c3ae4eb9af1a8). Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListItemcxx . . $ operation#GetSnapshotsListItem(3f3c3d0e9c0eb37f).(snapToKeep) +cxx . . $ operator+(fab9b4f80031f353). XnixSLASHcxx . . $ Global/XnixSLASH.); |
| 329 | else |
| 330 | rmArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("--filter=protect " +cxx . . $ operator+(c75c3ae4eb9af1a8). Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListItemcxx . . $ operation#GetSnapshotsListItem(3f3c3d0e9c0eb37f).(snapToKeep) +cxx . . $ operator+(fab9b4f80031f353). SLASHcxx . . $ Global/SLASH.); |
| 331 | snapToKeep++; |
| 332 | } |
| 333 | // protect the backup profile dir too |
| 334 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 335 | rmArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("--filter=protect " +cxx . . $ operator+(c75c3ae4eb9af1a8). profileNamecxx . . $ Global/profileName. +cxx . . $ operator+(3d22f08efddf8107). ".profile" +cxx . . $ operator+(fab9b4f80031f353). XnixSLASHcxx . . $ Global/XnixSLASH.); |
| 336 | else |
| 337 | rmArgs.appendcxx . . $ QList#append(77d9f17553126ecb).("--filter=protect " +cxx . . $ operator+(c75c3ae4eb9af1a8). profileNamecxx . . $ Global/profileName. +cxx . . $ operator+(3d22f08efddf8107). ".profile" +cxx . . $ operator+(fab9b4f80031f353). SLASHcxx . . $ Global/SLASH.); |
| 338 | |
| 339 | //also add all remote arguments exactly as used at normal backup |
| 340 | if (RemoteDestUsed) |
| 341 | rmArgs <<cxx . . $ QStringList#`operator<<`(cb3c3d1614140851). remoteArgs; |
| 342 | |
| 343 | rmArgs.appendcxx . . $ QList#append(77d9f17553126ecb).(snapEmptyDircxx . . $ Global/snapEmptyDir.); |
| 344 | rmArgs.appendcxx . . $ QList#append(77d9f17553126ecb).(tempDestination); |
| 345 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 346 | { |
| 347 | //bool createWinRsyncCommand(tempDirPath,QFile command1,QFile command2,bool vss,QString rsyncArgs,QString source,QString dest); |
| 348 | command2=cxx . . $ QString#`operator=`(4f35bf974e7f8568).createWinRsyncCommandcxx . . $ Global/createWinRsyncCommand(f72b83e3d8c9da9d).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTempPathcxx . . $ operation#GetTempPath(6ef7b6c27b00b43d).(),false,rmArgs,false); |
| 349 | if (command2==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."") |
| 350 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to create bat file in rmProccess"; |
| 351 | else |
| 352 | { |
| 353 | rmProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (command2); |
| 354 | rmProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(); |
| 355 | } |
| 356 | } |
| 357 | else |
| 358 | { |
| 359 | rmProcess -> startcxx . . $ QProcess#start(5e315ba9c811784d). (command,rmArgs); |
| 360 | rmProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a).(); |
| 361 | } |
| 362 | |
| 363 | if ((rmProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()) == 0) |
| 364 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nRemoved all older snapshots data";// << QString((tempDestination + Operation[currentOperation] -> GetSnapshotsListItem(0) + SLASH).toUtf8()).toStdString(); |
| 365 | else |
| 366 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to remove all older snapshots data";// << QString((tempDestination + Operation[currentOperation] -> GetSnapshotsListItem(0) + SLASH).toUtf8()).toStdString() << "\n"; |
| 367 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 368 | |
| 369 | countcxx . . $ commandline#count. = 0; |
| 370 | while ( countcxx . . $ commandline#count. < (currentSnaps -maxSnaps + 1 ) ) |
| 371 | { |
| 372 | //remove the changes file |
| 373 | snapchangesfilenamecxx . . $ Global/snapchangesfilename. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). snapChangesDircxx . . $ Global/snapChangesDir. +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(45672f3c6961a244).(profileNamecxx . . $ Global/profileName..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 374 | QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetNamecxx . . $ operation#GetName(6ef7b6c27b00b43d).()).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 375 | (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListItemcxx . . $ operation#GetSnapshotsListItem(3f3c3d0e9c0eb37f).(0)) +cxx . . $ operator+(3d22f08efddf8107). ".changes.log"; |
| 376 | snapfilecxx . . $ Global/snapfile..setFileNamecxx . . $ QFile#setFileName(3520e46b33348bf6).(snapchangesfilenamecxx . . $ Global/snapchangesfilename.); |
| 377 | if (snapfilecxx . . $ Global/snapfile..existscxx . . $ QFile#exists(50ce9a9e25b4a850).()) |
| 378 | { |
| 379 | if (snapfilecxx . . $ Global/snapfile..removecxx . . $ QFile#remove(c9857a73d68e59ba).()) // this is the old snapshot changes file |
| 380 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nRemoving " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).(snapchangesfilenamecxx . . $ Global/snapchangesfilename..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 381 | else |
| 382 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to remove " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).(snapchangesfilenamecxx . . $ Global/snapchangesfilename..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 383 | } |
| 384 | |
| 385 | //remove the oldest logfile |
| 386 | logfilenamecxx . . $ Global/logfilename. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). logDircxx . . $ Global/logDir. +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(45672f3c6961a244).(profileNamecxx . . $ Global/profileName..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 387 | QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetNamecxx . . $ operation#GetName(6ef7b6c27b00b43d).()).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 388 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListItemcxx . . $ operation#GetSnapshotsListItem(3f3c3d0e9c0eb37f).(0) +cxx . . $ operator+(3d22f08efddf8107). ".log"; |
| 389 | logfilecxx . . $ Global/logfile..setFileNamecxx . . $ QFile#setFileName(3520e46b33348bf6).(logfilenamecxx . . $ Global/logfilename.); // this is the old logfile |
| 390 | if (logfilecxx . . $ Global/logfile..existscxx . . $ QFile#exists(50ce9a9e25b4a850).()) |
| 391 | { |
| 392 | if (logfilecxx . . $ Global/logfile..removecxx . . $ QFile#remove(c9857a73d68e59ba).()) |
| 393 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nRemoving " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).(logfilenamecxx . . $ Global/logfilename..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 394 | else |
| 395 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to remove " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).(logfilenamecxx . . $ Global/logfilename..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 396 | } |
| 397 | |
| 398 | //remove the oldest snapshot (0) from the list |
| 399 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> RemoveSnapshotsListItemcxx . . $ operation#RemoveSnapshotsListItem(d4f767463ce0a6b3). (0); |
| 400 | countcxx . . $ commandline#count.++; |
| 401 | } |
| 402 | } |
| 403 | // the following is transfered in the very beginning of the actions for !DryRun, |
| 404 | /*else // this is just to create the .snapDefaultDir if it does not to exist so as to copy profile data later... |
| 405 | { |
| 406 | //we will create the snapshots default directory by using an rsync command with an empty source without --delete option |
| 407 | QProcess *mkdirProcess; mkdirProcess = new QProcess; |
| 408 | QStringList mkdirArgs; mkdirArgs.clear(); |
| 409 | if ( (WINrunning) && (RemoteDestUsed) ) |
| 410 | mkdirArgs << "--mkdir"; |
| 411 | else |
| 412 | mkdirArgs << "--progress" << "-r"; |
| 413 | |
| 414 | //add all remote arguments exactly as used at normal backup |
| 415 | if (RemoteDestUsed) |
| 416 | mkdirArgs << remoteArgs; |
| 417 | |
| 418 | mkdirArgs.append(snapEmptyDir); |
| 419 | mkdirArgs.append(tempDestination); |
| 420 | mkdirProcess -> start (command,mkdirArgs); |
| 421 | mkdirProcess -> waitForFinished(); |
| 422 | |
| 423 | if ((mkdirProcess -> exitCode()) == 0) |
| 424 | cout << "\n!!"; |
| 425 | else |
| 426 | cout << "\n!"; |
| 427 | |
| 428 | }*/ |
| 429 | |
| 430 | //set the current date and time as the operation's last execution date-time |
| 431 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> SetLastExecutionTimecxx . . $ operation#SetLastExecutionTime(738e092a5192a79). (QDateTimecxx . . $ QDateTime#::currentDateTimecxx . . $ QDateTime#currentDateTime(bf5129c8228c71c0).()); |
| 432 | |
| 433 | // add a new snapshot with the last execution date-time |
| 434 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> |
| 435 | AddSnapshotsListItemcxx . . $ operation#AddSnapshotsListItem(7df51288a9ebd664). ((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> |
| 436 | GetLastExecutionTimecxx . . $ operation#GetLastExecutionTime(4e062b5c490497ac).()).toStringcxx . . $ QDateTime#toString(5555d9024dcf93fb).("yyyyMMddhhmmss"cxx . . $ QString#QString(85c52e162fed56f9).)); |
| 437 | currentSnaps = Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListSizecxx . . $ operation#GetSnapshotsListSize(455f465bc33b4cdf).(); // update the current number of snapshots |
| 438 | |
| 439 | // set a new changes file. This has a tag of the previous snapshot will include changes made to this snapshot |
| 440 | snapchangesfilenamecxx . . $ Global/snapchangesfilename. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). snapChangesDircxx . . $ Global/snapChangesDir. +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(45672f3c6961a244).(profileNamecxx . . $ Global/profileName..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 441 | QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetNamecxx . . $ operation#GetName(6ef7b6c27b00b43d).()).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 442 | (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListItemcxx . . $ operation#GetSnapshotsListItem(3f3c3d0e9c0eb37f).(currentSnaps - 1)) +cxx . . $ operator+(3d22f08efddf8107). ".changes.log"; |
| 443 | snapfilecxx . . $ Global/snapfile..setFileNamecxx . . $ QFile#setFileName(3520e46b33348bf6).(snapchangesfilenamecxx . . $ Global/snapchangesfilename.); |
| 444 | |
| 445 | // set a new logfile |
| 446 | logfilenamecxx . . $ Global/logfilename. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). logDircxx . . $ Global/logDir. +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(45672f3c6961a244).(profileNamecxx . . $ Global/profileName..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 447 | QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetNamecxx . . $ operation#GetName(6ef7b6c27b00b43d).()).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()) +cxx . . $ operator+(3d22f08efddf8107). "-" +cxx . . $ operator+(fab9b4f80031f353). |
| 448 | ( Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSnapshotsListItemcxx . . $ operation#GetSnapshotsListItem(3f3c3d0e9c0eb37f).(currentSnaps - 1) ) +cxx . . $ operator+(3d22f08efddf8107). ".log"; |
| 449 | |
| 450 | logfilecxx . . $ Global/logfile..setFileNamecxx . . $ QFile#setFileName(3520e46b33348bf6).(logfilenamecxx . . $ Global/logfilename.); // this is the current logfile |
| 451 | if (logfilecxx . . $ Global/logfile..opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QIODevice#::WriteOnlycxx . . $ QIODevice#WriteOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QIODevicecxx . . $ QIODevice#::Textcxx . . $ QIODevice#Text. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). QIODevicecxx . . $ QIODevice#::Appendcxx . . $ QIODevice#Append.)) //create a new log file |
| 452 | { |
| 453 | writeToLogcxx . . $ Global/writeToLog. = true; //& if it's ok |
| 454 | syncProcess -> setStandardOutputFilecxx . . $ QProcess#setStandardOutputFile(8f4bc4a0c00c3d3f).(logfilenamecxx . . $ Global/logfilename., QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::Appendcxx . . $ QIODevice#Append. ); |
| 455 | syncProcess -> setStandardErrorFilecxx . . $ QProcess#setStandardErrorFile(8f4bc4a0c00c3d3f).(logfilenamecxx . . $ Global/logfilename., QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::Appendcxx . . $ QIODevice#Append. ); |
| 456 | } |
| 457 | else |
| 458 | { |
| 459 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nError writing to log:" <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).(logfilenamecxx . . $ Global/logfilename..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 460 | writeToLogcxx . . $ Global/writeToLog. = false; |
| 461 | } |
| 462 | |
| 463 | // reset the error counter |
| 464 | errorCountcxx . . $ commandline#errorCount. = 0; // Number of errors from one task (max value is 1) |
| 465 | } |
| 466 | |
| 467 | // The following part will be run as many times as the RepeatOnFail argument |
| 468 | // It includes execute before, task & execute after actions |
| 469 | int repeatTaskOnFailMax = Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetRepeatOnFailcxx . . $ operation#GetRepeatOnFail(455f465bc33b4cdf).(); // This holds the number of re-runs to try if the task fails for a reason |
| 470 | int RunTry = 0; // This run is No... RunTry |
| 471 | bool runNOW = true; |
| 472 | |
| 473 | //pre-task commands execution ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 474 | countcxx . . $ commandline#count. = 0; |
| 475 | bool StopTaskExecution = false; |
| 476 | |
| 477 | while ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteBeforeListSizecxx . . $ operation#GetExecuteBeforeListSize(455f465bc33b4cdf).() > countcxx . . $ commandline#count.) && (!StopTaskExecution) ) |
| 478 | { |
| 479 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 480 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Now executing pre-task command: " |
| 481 | <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteBeforeListItemcxx . . $ operation#GetExecuteBeforeListItem(3f3c3d0e9c0eb37f).(countcxx . . $ commandline#count.)).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 482 | |
| 483 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("pre-starting"cxx . . $ QString#QString(85c52e162fed56f9).,""cxx . . $ QString#QString(85c52e162fed56f9).,countcxx . . $ commandline#count.); //update the logfile |
| 484 | |
| 485 | RunTry = 0; // This run of the command is No... |
| 486 | runNOW = true; // run it this time |
| 487 | |
| 488 | while ( (RunTry < repeatTaskOnFailMax+1) && (runNOW) ) |
| 489 | { |
| 490 | runNOW = false; // do NOT run this another time if it goes ok |
| 491 | |
| 492 | if (RunTry > 0) |
| 493 | { |
| 494 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Repeating execution of pre-task command due to failure - run " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). RunTry+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " of " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). repeatTaskOnFailMax+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n"; |
| 495 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("repeat-on-fail"cxx . . $ QString#QString(85c52e162fed56f9).,""cxx . . $ QString#QString(85c52e162fed56f9).,countcxx . . $ commandline#count.); //update the logfile |
| 496 | } |
| 497 | |
| 498 | //syncProcess -> execute (Operation[currentOperation] -> GetExecuteBeforeListItem(count)); |
| 499 | syncProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteBeforeListItemcxx . . $ operation#GetExecuteBeforeListItem(3f3c3d0e9c0eb37f).(countcxx . . $ commandline#count.)); |
| 500 | |
| 501 | //wait for the process to start and finish |
| 502 | if (syncProcess -> waitForStartedcxx . . $ QProcess#waitForStarted(83c267b20bac841a). (-1)) // the "-1" arguments are used to avoid timing out |
| 503 | { |
| 504 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process started successfully\n"; |
| 505 | syncProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a). (-1); |
| 506 | } |
| 507 | else |
| 508 | { |
| 509 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process failed to start\n"; |
| 510 | errorCountcxx . . $ commandline#errorCount.++; |
| 511 | if (RunTry < repeatTaskOnFailMax+1) |
| 512 | runNOW = true; // run it another time because of error |
| 513 | |
| 514 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteBeforeListItemStatecxx . . $ operation#GetExecuteBeforeListItemState(4a668f6de69bf818).(countcxx . . $ commandline#count.) == true) && (RunTry == repeatTaskOnFailMax) ) |
| 515 | { |
| 516 | StopTaskExecution = true; |
| 517 | break; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nexit code : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).(); |
| 522 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nexit status : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitStatuscxx . . $ QProcess#exitStatus(15ed2eeed4841e77).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 523 | if (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).() != 0) |
| 524 | { |
| 525 | errorCountcxx . . $ commandline#errorCount.++; |
| 526 | if (RunTry < repeatTaskOnFailMax+1) |
| 527 | runNOW = true; // run it another time because of error |
| 528 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteBeforeListItemStatecxx . . $ operation#GetExecuteBeforeListItemState(4a668f6de69bf818).(countcxx . . $ commandline#count.) == true) && (RunTry == repeatTaskOnFailMax) ) |
| 529 | { |
| 530 | StopTaskExecution = true; |
| 531 | break; |
| 532 | } |
| 533 | } |
| 534 | RunTry++; |
| 535 | } // Main repeat-On-Fail loop -> The specific command will be repeated according to user setting |
| 536 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("pre-finished"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., countcxx . . $ commandline#count.); |
| 537 | countcxx . . $ commandline#count.++; |
| 538 | } // Execute before commands loop |
| 539 | |
| 540 | //task execution |
| 541 | if (StopTaskExecution) |
| 542 | { |
| 543 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("pre-task-exited-with-error"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 544 | |
| 545 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 546 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Pre-task command exited with an error. Skipping task execution..."; |
| 547 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n--------------------------------------------------------------------------------------------\n"; |
| 548 | } |
| 549 | else |
| 550 | { |
| 551 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 552 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Now executing : " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).((Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetNamecxx . . $ operation#GetName(6ef7b6c27b00b43d).()).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 553 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n--------------------------------------------------------------------------------------------\n"; |
| 554 | |
| 555 | if (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTypeSynccxx . . $ operation#GetTypeSync(50ce9a9e25b4a850).()) |
| 556 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-starting-syncAB"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 557 | else |
| 558 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-starting-backup"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 559 | |
| 560 | // Create the destination if it does not exist |
| 561 | bool DestCreateFail = false; // This will become true if destination does not exist and cannot be created |
| 562 | |
| 563 | rsyncArguments =cxx . . $ QStringList#`operator=`(335bb966c1744308). AppendArgumentscxx . . $ Global/AppendArguments(20f639a182fdbea2).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.]); //set rsync arguments |
| 564 | |
| 565 | dirB =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rsyncArguments[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).rsyncArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-1]; |
| 566 | QDircxx . . $ QDir# destCreatecxx . . $ QDir#QDir(3520e46b33348bf6). (dirBcxx . . $ QString#QString(45672f3c6961a244)..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()); |
| 567 | if ( (!destCreate.existscxx . . $ QDir#exists(50ce9a9e25b4a850).()) && (!Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTypeSynccxx . . $ operation#GetTypeSync(50ce9a9e25b4a850).()) && (!RemoteDestUsed) ) // local use ONLY |
| 568 | { |
| 569 | if (destCreate.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).(dirBcxx . . $ QString#QString(45672f3c6961a244)..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).())) |
| 570 | { |
| 571 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-standard"cxx . . $ QString#QString(85c52e162fed56f9)., "<br>Successfully created destination directory"cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 572 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n Successfully created destination directory\n"; |
| 573 | } |
| 574 | else |
| 575 | { |
| 576 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-error"cxx . . $ QString#QString(85c52e162fed56f9)., "<br>Failed to create destination directory"cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 577 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n Failed to create destination directory\n"; |
| 578 | DestCreateFail = true; |
| 579 | errorCountcxx . . $ commandline#errorCount.++; |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | if (!DestCreateFail) |
| 584 | { |
| 585 | //convert rsyncArguments to utf-8 for console compatibility |
| 586 | countcxx . . $ commandline#count.=0; |
| 587 | |
| 588 | |
| 589 | while (countcxx . . $ commandline#count. < rsyncArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()) |
| 590 | { |
| 591 | rsyncArguments[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).countcxx . . $ commandline#count.] =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(45672f3c6961a244).(rsyncArguments[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).countcxx . . $ commandline#count.].toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).()); |
| 592 | countcxx . . $ commandline#count.++; |
| 593 | } |
| 594 | |
| 595 | // add the --dry-run to arguments if applicable |
| 596 | if (DryRuncxx . . $ Global/DryRun.) |
| 597 | rsyncArguments.insertcxx . . $ QList#insert(20dcc09d4a3213bb).(rsyncArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-2,"--dry-run"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 598 | //if (writeToLog ) |
| 599 | // rsyncArguments.insert(rsyncArguments.size()-2,"--log-file="+logfilename); |
| 600 | |
| 601 | //syncProcess -> execute (command,rsyncArguments); // execute rsync command with rsyncArguments for backup or sync A->B |
| 602 | |
| 603 | // start the repeat on fail loop for the rsync command (backup or sync1) |
| 604 | RunTry = 0; // This run of the command is No... |
| 605 | runNOW = true; // run it this time |
| 606 | while ( (RunTry < repeatTaskOnFailMax+1) && (runNOW) ) |
| 607 | { |
| 608 | runNOW = false; // do NOT run this another time if it goes ok |
| 609 | if (RunTry > 0) |
| 610 | { |
| 611 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Repeating execution of rsync command due to failure - run " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). RunTry+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " of " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). repeatTaskOnFailMax+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n"; |
| 612 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("repeat-on-fail"cxx . . $ QString#QString(85c52e162fed56f9).,""cxx . . $ QString#QString(85c52e162fed56f9).,countcxx . . $ commandline#count.); //update the logfile |
| 613 | } |
| 614 | |
| 615 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 616 | { |
| 617 | //bool createWinRsyncCommand(tempDirPath,QFile command1,QFile command2,bool vss,QString rsyncArgs,QString source,QString dest); |
| 618 | command2=cxx . . $ QString#`operator=`(4f35bf974e7f8568).createWinRsyncCommandcxx . . $ Global/createWinRsyncCommand(f72b83e3d8c9da9d).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTempPathcxx . . $ operation#GetTempPath(6ef7b6c27b00b43d).(),Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.]->GetOptionsVsscxx . . $ operation#GetOptionsVss(50ce9a9e25b4a850).(),rsyncArguments,false); |
| 619 | if (command2==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."") |
| 620 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to create bat file in syncProccess"; |
| 621 | else |
| 622 | syncProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (command2); |
| 623 | } |
| 624 | else |
| 625 | syncProcess -> startcxx . . $ QProcess#start(5e315ba9c811784d). (command,rsyncArguments); |
| 626 | |
| 627 | //wait for the process to start and finish |
| 628 | if (syncProcess -> waitForStartedcxx . . $ QProcess#waitForStarted(83c267b20bac841a). (-1)) // the "-1" arguments are used to avoid timing out |
| 629 | { |
| 630 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process started successfully\n"; |
| 631 | syncProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a). (-1); |
| 632 | } |
| 633 | else |
| 634 | { |
| 635 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process failed to start\n"; |
| 636 | errorCountcxx . . $ commandline#errorCount.++; |
| 637 | } |
| 638 | |
| 639 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nrsync exit code : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).(); |
| 640 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nrsync exit status : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitStatuscxx . . $ QProcess#exitStatus(15ed2eeed4841e77).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 641 | if (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).() != 0) |
| 642 | errorCountcxx . . $ commandline#errorCount.++; |
| 643 | |
| 644 | /* If there is an error repeat the rsync command. Errors: |
| 645 | 5 - Error starting client-server protocol |
| 646 | 12 - Error in rsync protocol data stream |
| 647 | 23 - Partial transfer due to error -> I took this out |
| 648 | 30 - Timeout in data send/receive |
| 649 | 35 - Timeout waiting for daemon connection |
| 650 | 255 - unexplained error */ |
| 651 | if ( (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==30) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==35) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==255) || |
| 652 | (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==12) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==5) ) |
| 653 | runNOW = true; |
| 654 | |
| 655 | RunTry++; |
| 656 | } // The repeat-on-fail loop |
| 657 | if (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTypeSynccxx . . $ operation#GetTypeSync(50ce9a9e25b4a850).()) |
| 658 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-finished-sync1"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 659 | else |
| 660 | { |
| 661 | // strip unused lines from the snapshot changes file |
| 662 | QStringcxx . . $ QString# filesAdded = ""cxx . . $ QString#QString(85c52e162fed56f9)., snapLine = ""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 663 | if (snapfilecxx . . $ Global/snapfile..opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QIODevice#::ReadOnlycxx . . $ QIODevice#ReadOnly. |cxx . . $ `operator|`(c9e45f682471e48d). QIODevicecxx . . $ QIODevice#::Textcxx . . $ QIODevice#Text.)) |
| 664 | { |
| 665 | QTextStreamcxx . . $ QTextStream# incxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&snapfilecxx . . $ Global/snapfile.); |
| 666 | while (!in.atEndcxx . . $ QTextStream#atEnd(50ce9a9e25b4a850).()) |
| 667 | { |
| 668 | snapLine =cxx . . $ QString#`operator=`(4f35bf974e7f8568). in.readLinecxx . . $ QTextStream#readLine(20e0a2766677f583).(); |
| 669 | if (snapLine.containscxx . . $ QString#contains(8cce4688c16f48f3).("+++++++"cxx . . $ QString#QString(85c52e162fed56f9)., Qtcxx . . $ Qt/::CaseInsensitivecxx . . $ Qt/CaseInsensitive.)) |
| 670 | { |
| 671 | snapLine =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). snapLine.rightcxx . . $ QString#right(3f3c3d0e9c0eb37f).(snapLine.sizecxx . . $ QString#size(455f465bc33b4cdf).()-snapLine.lastIndexOfcxx . . $ QString#lastIndexOf(a1e52806cd31c200).("[LB]"cxx . . $ QString#QString(85c52e162fed56f9).)-removeCharLimitcxx . . $ Global/removeCharLimit.) +cxx . . $ operator+(3d22f08efddf8107). "\n"; |
| 672 | filesAdded.appendcxx . . $ QString#append(6a89d0b7f4d2681c).(snapLine); |
| 673 | } |
| 674 | } |
| 675 | snapfilecxx . . $ Global/snapfile..closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 676 | } |
| 677 | if (snapfilecxx . . $ Global/snapfile..opencxx . . $ QFile#open(dca164408be960c8).(QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::WriteOnlycxx . . $ QIODevice#WriteOnly.)) |
| 678 | { |
| 679 | QTextStreamcxx . . $ QTextStream# outcxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&snapfilecxx . . $ Global/snapfile.); |
| 680 | out <<cxx . . $ QTextStream#`operator<<`(f61e69e0d177108f). filesAdded; |
| 681 | snapfilecxx . . $ Global/snapfile..closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 682 | } |
| 683 | |
| 684 | QStringcxx . . $ QString# exportProfileDir = ""cxx . . $ QString#QString(85c52e162fed56f9).; QStringcxx . . $ QString# sourceLast = Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetSourcecxx . . $ operation#GetSource(6ef7b6c27b00b43d).(); |
| 685 | //calculate the last folder of source |
| 686 | if (!sourceLast.endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).(SLASHcxx . . $ Global/SLASH.)) // this means task is of type "backup dir by name" |
| 687 | sourceLast =cxx . . $ QString#`operator=`(4f35bf974e7f8568). calculateLastPathcxx . . $ Global/calculateLastPath(f7f320d754b8fd09).(sourceLastcxx . . $ QString#QString(132dd6869045752b).); // This is the lowest dir of the source |
| 688 | else |
| 689 | sourceLast =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 690 | |
| 691 | if (!rsyncArguments.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) //rsyncArguments is calculated at executeRsync() |
| 692 | { |
| 693 | if (WINrunningcxx . . $ Global/WINrunning. && RemoteDestUsed) |
| 694 | exportProfileDir =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rsyncArguments.lastcxx . . $ QList#last(19b2b6f17af048b).() +cxx . . $ operator+(fab9b4f80031f353). sourceLast +cxx . . $ operator+(fab9b4f80031f353). XnixSLASHcxx . . $ Global/XnixSLASH. +cxx . . $ operator+(fab9b4f80031f353). snapDefaultDircxx . . $ Global/snapDefaultDir. +cxx . . $ operator+(fab9b4f80031f353). profileNamecxx . . $ Global/profileName. +cxx . . $ operator+(3d22f08efddf8107). ".profile" +cxx . . $ operator+(fab9b4f80031f353). XnixSLASHcxx . . $ Global/XnixSLASH.; |
| 695 | else |
| 696 | exportProfileDir =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rsyncArguments.lastcxx . . $ QList#last(19b2b6f17af048b).() +cxx . . $ operator+(fab9b4f80031f353). sourceLast +cxx . . $ operator+(fab9b4f80031f353). SLASHcxx . . $ Global/SLASH. +cxx . . $ operator+(fab9b4f80031f353). snapDefaultDircxx . . $ Global/snapDefaultDir. +cxx . . $ operator+(fab9b4f80031f353). profileNamecxx . . $ Global/profileName. +cxx . . $ operator+(3d22f08efddf8107). ".profile" +cxx . . $ operator+(fab9b4f80031f353). SLASHcxx . . $ Global/SLASH.; |
| 697 | } |
| 698 | |
| 699 | // Backup profile + logs + snaps to destination |
| 700 | // If this is a backup task && not a dryrun |
| 701 | if ( (!Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTypeSynccxx . . $ operation#GetTypeSync(50ce9a9e25b4a850).()) && (!DryRuncxx . . $ Global/DryRun.) && (!rsyncArguments.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) ) |
| 702 | { |
| 703 | // Create the export path if it does not exist |
| 704 | QDircxx . . $ QDir# exportPathCreatecxx . . $ QDir#QDir(3520e46b33348bf6). (exportProfileDir); |
| 705 | if ( (!exportPathCreate.existscxx . . $ QDir#exists(50ce9a9e25b4a850).()) && (!RemoteDestUsed) ) // local use ONLY |
| 706 | exportPathCreate.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).(exportProfileDir); |
| 707 | |
| 708 | if (exportFullProfilecxx . . $ Global/exportFullProfile(80825a4bb658cac2).(exportProfileDircxx . . $ QString#QString(132dd6869045752b).,"ExportOnlyTask"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 709 | { |
| 710 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Backing-up profile, logfiles and snapshot data -> Ok\n"; |
| 711 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("backup-profile"cxx . . $ QString#QString(85c52e162fed56f9)., " -> Ok"cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 712 | } |
| 713 | else |
| 714 | { |
| 715 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Backing-up profile, logfiles and snapshot data -> FAILED\n"; |
| 716 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("backup-profile"cxx . . $ QString#QString(85c52e162fed56f9)., " -> Fail"cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-finished"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 721 | } |
| 722 | |
| 723 | |
| 724 | if (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTypeSynccxx . . $ operation#GetTypeSync(50ce9a9e25b4a850).()) //execute rsync for syncing B -> A |
| 725 | { |
| 726 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-starting-syncBA"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 727 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n Now executing 2nd part of sync task...\n"; |
| 728 | |
| 729 | dirA =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rsyncArguments[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).rsyncArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-2]; //swap last 2 arguments (dir names) |
| 730 | dirB =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). rsyncArguments[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).rsyncArguments.sizecxx . . $ QList#size(ea6fe5115c70a13f).()-1]; |
| 731 | rsyncArguments.removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).(); rsyncArguments.removeLastcxx . . $ QList#removeLast(49f6e7a06ebc5aa8).(); |
| 732 | rsyncArguments.appendcxx . . $ QList#append(77d9f17553126ecb).(dirB); |
| 733 | rsyncArguments.appendcxx . . $ QList#append(77d9f17553126ecb).(dirA); |
| 734 | |
| 735 | // start the repeat on fail loop for the rsync command (sync2) |
| 736 | RunTry = 0; // This run of the command is No... |
| 737 | runNOW = true; // run it this time |
| 738 | while ( (RunTry < repeatTaskOnFailMax+1) && (runNOW) ) |
| 739 | { |
| 740 | runNOW = false; // do NOT run this another time if it goes ok |
| 741 | if (RunTry > 0) |
| 742 | { |
| 743 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Repeating execution of rsync command due to failure - run " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). RunTry+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " of " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). repeatTaskOnFailMax+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n"; |
| 744 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("repeat-on-fail"cxx . . $ QString#QString(85c52e162fed56f9).,""cxx . . $ QString#QString(85c52e162fed56f9).,countcxx . . $ commandline#count.); //update the logfile |
| 745 | } |
| 746 | |
| 747 | //syncProcess -> execute (command,rsyncArguments); // execute rsync command with rsyncArguments B->A |
| 748 | if (WINrunningcxx . . $ Global/WINrunning.) |
| 749 | { |
| 750 | //bool createWinRsyncCommand(tempDirPath,QFile command1,QFile command2,bool vss,QString rsyncArgs,QString source,QString dest); |
| 751 | command2=cxx . . $ QString#`operator=`(4f35bf974e7f8568).createWinRsyncCommandcxx . . $ Global/createWinRsyncCommand(f72b83e3d8c9da9d).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetTempPathcxx . . $ operation#GetTempPath(6ef7b6c27b00b43d).(),Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.]->GetOptionsVsscxx . . $ operation#GetOptionsVss(50ce9a9e25b4a850).(),rsyncArguments,false); |
| 752 | if (command2==cxx . . $ QString#`operator==`(7d4bdb1abc417636)."") |
| 753 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nfailed to create bat file in rmProccess"; |
| 754 | else |
| 755 | syncProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (command2); |
| 756 | } |
| 757 | else |
| 758 | syncProcess -> startcxx . . $ QProcess#start(5e315ba9c811784d). (command,rsyncArguments); |
| 759 | if (syncProcess -> waitForStartedcxx . . $ QProcess#waitForStarted(83c267b20bac841a). (-1)) // the "-1" arguments are used to avoid timing out |
| 760 | { |
| 761 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process started successfully\n"; |
| 762 | syncProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a). (-1); |
| 763 | } |
| 764 | else |
| 765 | { |
| 766 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process failed to start\n"; |
| 767 | errorCountcxx . . $ commandline#errorCount.++; |
| 768 | } |
| 769 | |
| 770 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nrsync exit code : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).(); |
| 771 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nrsync exit status : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitStatuscxx . . $ QProcess#exitStatus(15ed2eeed4841e77).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 772 | if (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).() != 0) |
| 773 | errorCountcxx . . $ commandline#errorCount.++; |
| 774 | |
| 775 | // If there is an error repeat the rsync command. Errors |
| 776 | if ( (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==30) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==35) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==255) || |
| 777 | (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==12) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==5) || (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).()==23) ) |
| 778 | runNOW = true; |
| 779 | |
| 780 | RunTry++; |
| 781 | } // The repeat-on-fail loop |
| 782 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("rsync-finished"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 783 | |
| 784 | } |
| 785 | |
| 786 | //post-task commands execution |
| 787 | countcxx . . $ commandline#count. = 0; |
| 788 | while ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteAfterListSizecxx . . $ operation#GetExecuteAfterListSize(455f465bc33b4cdf).() > countcxx . . $ commandline#count.) && (!StopTaskExecution) ) |
| 789 | { |
| 790 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 791 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Now executing post-task command: " |
| 792 | <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QStringcxx . . $ QString#QString(45672f3c6961a244).(Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteAfterListItemcxx . . $ operation#GetExecuteAfterListItem(3f3c3d0e9c0eb37f).(countcxx . . $ commandline#count.).toUtf8cxx . . $ QString#toUtf8(7c2073558a834e49).()).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 793 | |
| 794 | //update the logfile |
| 795 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("post-starting"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., countcxx . . $ commandline#count.); |
| 796 | |
| 797 | RunTry = 0; // This run of the command is No... |
| 798 | runNOW = true; // run it this time |
| 799 | while ( (RunTry < repeatTaskOnFailMax+1) && (runNOW) ) |
| 800 | { |
| 801 | runNOW = false; // do NOT run this another time if it goes ok |
| 802 | if (RunTry > 0) |
| 803 | { |
| 804 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n Repeating execution of post-rsync command due to failure - run " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). RunTry+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " of " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). repeatTaskOnFailMax+1 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n"; |
| 805 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("repeat-on-fail"cxx . . $ QString#QString(85c52e162fed56f9).,""cxx . . $ QString#QString(85c52e162fed56f9).,countcxx . . $ commandline#count.); //update the logfile |
| 806 | } |
| 807 | |
| 808 | //syncProcess -> execute (Operation[currentOperation] -> GetExecuteAfterListItem(count)); |
| 809 | |
| 810 | syncProcess -> startcxx . . $ QProcess#start(8f4bc4a0c00c3d3f). (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteAfterListItemcxx . . $ operation#GetExecuteAfterListItem(3f3c3d0e9c0eb37f).(countcxx . . $ commandline#count.)); |
| 811 | if (syncProcess -> waitForStartedcxx . . $ QProcess#waitForStarted(83c267b20bac841a). (-1)) // the "-1" arguments are used to avoid timing out |
| 812 | { |
| 813 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process started successfully\n"; |
| 814 | syncProcess -> waitForFinishedcxx . . $ QProcess#waitForFinished(83c267b20bac841a). (-1); |
| 815 | } |
| 816 | else |
| 817 | { |
| 818 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nThe process failed to start\n"; |
| 819 | errorCountcxx . . $ commandline#errorCount.++; |
| 820 | |
| 821 | if (RunTry < repeatTaskOnFailMax+1) |
| 822 | runNOW = true; // run it another time because of error |
| 823 | |
| 824 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteAfterListItemStatecxx . . $ operation#GetExecuteAfterListItemState(4a668f6de69bf818).(countcxx . . $ commandline#count.) == true) && (RunTry == repeatTaskOnFailMax) ) |
| 825 | { |
| 826 | StopTaskExecution = true; |
| 827 | break; |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nexit code : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).(); |
| 832 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\nexit status : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). syncProcess -> exitStatuscxx . . $ QProcess#exitStatus(15ed2eeed4841e77).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 833 | if (syncProcess -> exitCodecxx . . $ QProcess#exitCode(455f465bc33b4cdf).() != 0) |
| 834 | { |
| 835 | errorCountcxx . . $ commandline#errorCount.++; |
| 836 | |
| 837 | if (RunTry < repeatTaskOnFailMax+1) |
| 838 | runNOW = true; // run it another time because of error |
| 839 | |
| 840 | if ( (Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> GetExecuteAfterListItemStatecxx . . $ operation#GetExecuteAfterListItemState(4a668f6de69bf818).(countcxx . . $ commandline#count.) == true) && (RunTry == repeatTaskOnFailMax) ) |
| 841 | { |
| 842 | StopTaskExecution = true; |
| 843 | break; |
| 844 | } |
| 845 | } |
| 846 | |
| 847 | RunTry++; |
| 848 | } // The repeat-on-fail loop |
| 849 | |
| 850 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("post-finished"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., countcxx . . $ commandline#count.); |
| 851 | |
| 852 | countcxx . . $ commandline#count.++; |
| 853 | } |
| 854 | |
| 855 | if (StopTaskExecution) |
| 856 | { |
| 857 | logFileUpdatecxx . . $ Global/logFileUpdate(5faf0f1f209776e3).("pre-task-exited-with-error"cxx . . $ QString#QString(85c52e162fed56f9)., ""cxx . . $ QString#QString(85c52e162fed56f9)., 0); |
| 858 | |
| 859 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 860 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Post-task command exited with an error. Skipping executing the rest of commands..."; |
| 861 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n--------------------------------------------------------------------------------------------\n"; |
| 862 | } |
| 863 | |
| 864 | } |
| 865 | } // Task & execute after task loop |
| 866 | |
| 867 | |
| 868 | |
| 869 | // close the logfile |
| 870 | if (writeToLogcxx . . $ Global/writeToLog.){ |
| 871 | QTextStreamcxx . . $ QTextStream# outcxx . . $ QTextStream#QTextStream(bebe8f2dee7f9e86).(&logfilecxx . . $ Global/logfile.); |
| 872 | out <<cxx . . $ QTextStream#`operator<<`(a8e98279dde0dccf). "<pre>"; |
| 873 | logfilecxx . . $ Global/logfile..closecxx . . $ QFileDevice#close(49f6e7a06ebc5aa8).(); |
| 874 | } |
| 875 | |
| 876 | // Update the last execution errors and .changes file if real run |
| 877 | if (!DryRuncxx . . $ Global/DryRun.) |
| 878 | Operationcxx . . $ Global/Operation.[currentOperationcxx . . $ Global/currentOperation.] -> SetLastExecutionErrorscxx . . $ operation#SetLastExecutionErrors(d4f767463ce0a6b3). (errorCountcxx . . $ commandline#errorCount.); // update the last execution errors |
| 879 | |
| 880 | errorsFoundcxx . . $ Global/errorsFound. = errorsFoundcxx . . $ Global/errorsFound. + errorCountcxx . . $ commandline#errorCount.; |
| 881 | errorCountcxx . . $ commandline#errorCount. = 0; |
| 882 | } |
| 883 | currentOperationcxx . . $ Global/currentOperation.++; |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | |
| 888 | // thats_all=================================================================================================================== |
| 889 | // Displays an "all done" message |
| 890 | void commandlinecxx . . $ commandline#::thats_allcxx . . $ commandline#thats_all(49f6e7a06ebc5aa8).() |
| 891 | { |
| 892 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "============================================================================================\n"; |
| 893 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). QDateTimecxx . . $ QDateTime#::currentDateTimecxx . . $ QDateTime#currentDateTime(bf5129c8228c71c0).().toStringcxx . . $ QDateTime#toString(7b7e68bded046f2f).(Qtcxx . . $ Qt/::SystemLocaleLongDatecxx . . $ Qt/SystemLocaleLongDate.).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 894 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Syncing and backing up is finished"; |
| 895 | if (DryRuncxx . . $ Global/DryRun.) |
| 896 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " (simulation mode)"; |
| 897 | if (errorsFoundcxx . . $ Global/errorsFound. == 0) |
| 898 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n No errors found"; |
| 899 | else |
| 900 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n errors found: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). countStrcxx . . $ Global/countStr..setNumcxx . . $ QString#setNum(6483560ce2afa901).(errorsFoundcxx . . $ Global/errorsFound.).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 901 | if (writeToLogcxx . . $ Global/writeToLog.) |
| 902 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n logfile(s) have been created under directory: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). logDircxx . . $ Global/logDir..toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 903 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n hope everything went ok ;-)\n"; |
| 904 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "============================================================================================\n"; |
| 905 | |
| 906 | saveProfilecxx . . $ Global/saveProfile(7dc6c9a0b6a7270f).(QStringcxx . . $ QString#QString(45672f3c6961a244).(currentProfilecxx . . $ Global/currentProfile..toUtf8cxx . . $ QString#toUtf8(ef52b713090bc85a).())); // updates the execution time |
| 907 | |
| 908 | // send an email |
| 909 | if ( (!emailNevercxx . . $ Global/emailNever.) && (!DryRuncxx . . $ Global/DryRun.) ) |
| 910 | { |
| 911 | bool send = true; |
| 912 | if ( ((emailErrorcxx . . $ Global/emailError.) && (errorsFoundcxx . . $ Global/errorsFound. == 0)) // do not send if the condition "error" is checked and there are no errors |
| 913 | || |
| 914 | ((emailSchedulecxx . . $ Global/emailSchedule.) && (!NoQuestionscxx . . $ Global/NoQuestions.)) ) // do not send if the condition "scheduled" is checked |
| 915 | // & --no-questions is NOT given as argument |
| 916 | send = false; |
| 917 | |
| 918 | // ***** gui mode and "schedule" is covered in executenow.cpp ****** |
| 919 | |
| 920 | if (send) |
| 921 | { |
| 922 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; |
| 923 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "trying to send an email\n"; |
| 924 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " . . .\n\n"; |
| 925 | coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(88df5bef833f7f83). sendEmailNowcxx . . $ Global/sendEmailNow(f4d483874300e612).(false).toStdStringcxx . . $ QString#toStdString(219584694fe2b248).(); |
| 926 | } |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | |
| 931 | // end of commandline.cpp--------------------------------------------------------- |
| 932 |