multi dataset

This commit is contained in:
2026-02-16 02:37:31 +01:00
parent 1903535dc5
commit a330ce9834
7 changed files with 456 additions and 25 deletions

View File

@@ -23,9 +23,16 @@ func main() {
switch command {
case "snap", "snapshot":
// Create snapshot and send to server (auto full/incremental)
// Optional: specify dataset as argument
targetDataset := ""
if len(os.Args) > 2 {
targetDataset = os.Args[2]
fmt.Printf("→ Using dataset: %s\n", targetDataset)
}
fmt.Println("=== Creating and sending snapshot ===\n")
snapshot, err := c.CreateAndSend()
snapshot, err := c.CreateAndSend(targetDataset)
if err != nil {
fmt.Printf("Error: %v\n", err)
os.Exit(1)
@@ -56,11 +63,12 @@ func main() {
func printUsage() {
fmt.Println("ZFS Snapshot Backup Client - Simple Version")
fmt.Println("\nUsage: zfs-client [command]")
fmt.Println("\nUsage: zfs-client [command] [dataset]")
fmt.Println("\nCommands:")
fmt.Println(" snap - Create snapshot and send to server")
fmt.Println(" status - Check server connection and quota")
fmt.Println(" help - Show this help message")
fmt.Println(" snap [dataset] - Create snapshot and send to server")
fmt.Println(" If dataset not specified, uses LOCAL_DATASET from config")
fmt.Println(" status - Check server connection and quota")
fmt.Println(" help - Show this help message")
fmt.Println("\nEnvironment Variables (can be set in .env file):")
fmt.Println(" CLIENT_ID - Client identifier (default: client1)")
fmt.Println(" API_KEY - API key for authentication (default: secret123)")
@@ -68,6 +76,7 @@ func printUsage() {
fmt.Println(" LOCAL_DATASET - ZFS dataset to backup (default: tank/data)")
fmt.Println(" COMPRESS - Enable LZ4 compression (default: true)")
fmt.Println("\nExamples:")
fmt.Println(" zfs-client snap")
fmt.Println(" zfs-client snap # Use configured dataset")
fmt.Println(" zfs-client snap tank/data # Backup specific dataset")
fmt.Println(" zfs-client status")
}