diff --git a/README.md b/README.md index 071bd77..de01ea9 100644 --- a/README.md +++ b/README.md @@ -103,5 +103,5 @@ This allows connecting to older routers that require legacy SSH algorithms while ## Documentation - **[Detailed Documentation](docs/DETAILS.md)** - Complete feature guide, configuration reference, and examples -- **[Manual Page](docs/router_backup.1)** - Unix manual page +- **[Manual Page](docs/ipng-router-backup.1)** - Unix manual page - **[Changelog](debian/changelog)** - Version history and changes diff --git a/debian/rules b/debian/rules index 641590a..fe3a170 100755 --- a/debian/rules +++ b/debian/rules @@ -18,7 +18,7 @@ override_dh_auto_install: mkdir -p debian/ipng-router-backup/usr/share/man/man1 cp ipng-router-backup debian/ipng-router-backup/usr/bin/ cp etc/* debian/ipng-router-backup/etc/ipng-router-backup/ - cp docs/router_backup.1 debian/ipng-router-backup/usr/share/man/man1/ipng-router-backup.1 + cp docs/ipng-router-backup.1 debian/ipng-router-backup/usr/share/man/man1/ipng-router-backup.1 gzip debian/ipng-router-backup/usr/share/man/man1/ipng-router-backup.1 override_dh_auto_clean: diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 880b4a0..b77924b 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -188,5 +188,7 @@ Software Version : v25.3.2 - **Permission issues**: Verify SSH key permissions (600) and output directory access ### Exit Codes -- `0`: Success -- `1`: Configuration error, authentication failure, or connection issues \ No newline at end of file +- `0`: Success (all devices processed successfully) +- `1`: Configuration error, authentication failure, or connection issues +- `10`: Some devices failed +- `11`: All devices failed \ No newline at end of file diff --git a/docs/router_backup.1 b/docs/ipng-router-backup.1 similarity index 96% rename from docs/router_backup.1 rename to docs/ipng-router-backup.1 index 5db20fa..8d3c6d8 100644 --- a/docs/router_backup.1 +++ b/docs/ipng-router-backup.1 @@ -98,10 +98,16 @@ Example configuration file .SH EXIT STATUS .TP .B 0 -Success +Success (all devices processed successfully) .TP .B 1 General error (configuration file not found, authentication failure, etc.) +.TP +.B 10 +Some devices failed +.TP +.B 11 +All devices failed .SH AUTHOR Written by Pim van Pelt. .SH REPORTING BUGS diff --git a/src/main.go b/src/main.go index 43efc03..a5b5cfa 100644 --- a/src/main.go +++ b/src/main.go @@ -120,6 +120,14 @@ func main() { } fmt.Printf("\nOverall summary: %d/%d devices processed successfully\n", successCount, totalCount) + + // Set exit code based on results + if successCount == 0 { + os.Exit(11) // All devices failed + } else if successCount < totalCount { + os.Exit(10) // Some devices failed + } + // Exit code 0 (success) when all devices succeeded }, }