.TH ROUTER_BACKUP 1 "July 2025" "router-backup 1.0.0" "User Commands" .SH NAME router_backup \- SSH Router Backup Tool .SH SYNOPSIS .B router_backup .RI --config " CONFIG_FILE" .RI [ --git-repo " DIRECTORY" ] .RI [ --password " PASSWORD" ] .RI [ --key-file " KEYFILE" ] .RI [ --port " PORT" ] .SH DESCRIPTION .B router_backup is a tool for backing up router configurations via SSH. It connects to multiple routers defined in a YAML configuration file and executes commands, saving the output to files. .PP The tool supports multiple device types with predefined command sets, SSH agent authentication, and automatic file organization. .SH OPTIONS .TP .BR --config " \fICONFIG_FILE\fR" YAML configuration file path (required) .TP .BR --git-repo " \fIDIRECTORY\fR" Git repository directory for command output files (default: /tmp) .TP .BR --password " \fIPASSWORD\fR" SSH password for authentication .TP .BR --key-file " \fIKEYFILE\fR" SSH private key file path .TP .BR --port " \fIPORT\fR" SSH port number (default: 22) .TP .BR --help Show help message .SH CONFIGURATION The configuration file uses YAML format with two main sections: .SS types Define device types with their command sets: .PP .EX types: srlinux: commands: - show version - show platform linecard .EE .SS devices Define individual devices: .PP .EX devices: router1: user: admin type: srlinux .EE .SH AUTHENTICATION Authentication is attempted in the following order: .IP 1. SSH agent (if SSH_AUTH_SOCK environment variable is set) .IP 2. Specified key file (--key-file option) .IP 3. Default SSH keys (~/.ssh/id_rsa, ~/.ssh/id_ed25519, ~/.ssh/id_ecdsa) .IP 4. Password authentication (--password option) .SH OUTPUT For each device, a text file named after the hostname is created in the specified directory. Each command output is prefixed with "## COMMAND: " for easy identification. .SH EXAMPLES .TP Basic usage: .EX router_backup --config /etc/router-backup/config.yaml .EE .TP Custom output directory: .EX router_backup --config config.yaml --git-repo /home/user/backups .EE .TP Using password authentication: .EX router_backup --config config.yaml --password mysecretpass .EE .SH FILES .TP .I /etc/router-backup/config.yaml.example Example configuration file .SH EXIT STATUS .TP .B 0 Success .TP .B 1 General error (configuration file not found, authentication failure, etc.) .SH AUTHOR Written by Pim van Pelt. .SH REPORTING BUGS Report bugs to .SH SEE ALSO .BR ssh (1), .BR ssh-agent (1), .BR dpkg (1)