This commit is contained in:
Your Name
2025-04-21 14:54:33 +12:00
parent 0a2036cbd7
commit 50bd2e2446
13 changed files with 288 additions and 115 deletions

View File

@ -24,8 +24,10 @@ void print_help() {
std::cout << " servers List configured servers" << std::endl;
std::cout << " servers NAME Show details for specific server" << std::endl;
std::cout << " templates List available templates" << std::endl;
std::cout << " install SERVER SERVICE Install a service on a server" << std::endl;
std::cout << " run SERVER SERVICE COMMAND Run a command on a specific service" << std::endl;
std::cout << std::endl;
std::cout << " install SERVER SERVICE (Re)install a service on a server." << std::endl;
std::cout << " backup SERVER SERVICE Backup a service on a server." << std::endl;
std::cout << " run SERVER SERVICE COMMAND Run a command on a specific service" << std::endl;
std::cout << std::endl;
std::cout << "Examples:" << std::endl;
std::cout << " dropshell servers" << std::endl;
@ -157,7 +159,28 @@ int main(int argc, char* argv[]) {
}
if (!service.run_command(command)) {
std::cerr << "Error: Failed to run command" << std::endl;
std::cerr << command +" failed." << std::endl;
return 1;
}
return 0;
}
if (cmd == "backup") {
if (argc < 4) {
std::cerr << "Error: backup command requires server name and service name" << std::endl;
return 1;
}
std::string server_name = argv[2];
std::string service_name = argv[3];
dropshell::server_service service;
if (!service.init(server_name, service_name)) {
std::cerr << "Error: Failed to initialize service" << std::endl;
return 1;
}
if (!service.backup()) {
std::cerr << "Backup failed." << std::endl;
return 1;
}
return 0;