Rework backup/restore

This commit is contained in:
Your Name
2025-05-02 23:00:41 +12:00
parent 710a8c762f
commit d1a739cdd0
5 changed files with 264 additions and 344 deletions

View File

@ -30,6 +30,7 @@ typedef struct ServiceStatus {
std::vector<int> ports;
} ServiceStatus;
class service_runner {
public:
service_runner(const std::string& server_name, const std::string& service_name);
@ -44,7 +45,7 @@ class service_runner {
// checking that the command exists in the service directory.
// checking that the command is a valid .sh file.
// checking that the {service_name}.env file exists in the service directory.
bool run_command(const std::string& command);
bool run_command(const std::string& command, std::vector<std::string> additional_args={});
// check health of service. Silent.
// 1. run status.sh on the server
@ -79,10 +80,9 @@ class service_runner {
// 4. remove the service directory from the server
bool uninstall();
// restore the service over ssh, using the credentials from server.env (via server_env.hpp)
// 1. copy the backup file to the server's DROPSHELL_DIR/backups folder
// 2. run the restore.sh script on the server, passing the {service_name}.env file as an argument
bool restore(std::string backup_file);
// backup and restore
bool backup(bool silent=false);
bool restore(std::string backup_file, bool silent=false);
// launch an interactive ssh session on a server or service
// replaces the current dropshell process with the ssh process