Working on restore
This commit is contained in:
@ -127,6 +127,15 @@ int restore(const std::vector<std::string> &args)
|
||||
}
|
||||
std::cout << "Backup complete." << std::endl;
|
||||
}
|
||||
{ // uninstalling the current service
|
||||
std::cout << "2) Uninstalling current service..." << std::endl;
|
||||
if (!uninstall(uninstall_args,true)) // silent=true
|
||||
{
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "Error: Uninstall failed, restore aborted." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
{ // restore service from backup
|
||||
std::cout << "2) Restoring service from backup..." << std::endl;
|
||||
@ -202,7 +211,7 @@ int backup(const std::vector<std::string> & args, bool silent) {
|
||||
// Create backups directory on server if it doesn't exist
|
||||
std::string remote_backups_dir = get_remote_backups_path(server_name);
|
||||
if (!silent) std::cout << "Remote backups directory on "<< server_name <<": " << remote_backups_dir << std::endl;
|
||||
std::string mkdir_cmd = "'mkdir -p " + quote(remote_backups_dir) + "'";
|
||||
std::string mkdir_cmd = "mkdir -p " + quote(remote_backups_dir);
|
||||
if (!env.execute_ssh_command(mkdir_cmd)) {
|
||||
std::cerr << "Failed to create backups directory on server" << std::endl;
|
||||
return false;
|
||||
|
@ -84,7 +84,7 @@ std::string server_env::construct_standard_command_run_cmd(const std::string &se
|
||||
argstr += " " + quote(dequote(trim(arg)));
|
||||
}
|
||||
|
||||
sCommand scommand(remote_service_template_path, "bash " + quote(script_path) + " " + argstr + (silent ? " > /dev/null 2>&1" : ""), env_vars);
|
||||
sCommand scommand(remote_service_template_path, "bash " + quote(script_path) + argstr + (silent ? " > /dev/null 2>&1" : ""), env_vars);
|
||||
std::string run_cmd = scommand.construct_safecmd();
|
||||
return run_cmd;
|
||||
}
|
||||
|
Reference in New Issue
Block a user