Skip to content

Script to backup the EdgeRouter configuration, copy it to a linux server and send us a message with the file to Telegram.

Notifications You must be signed in to change notification settings

azagramac/backup-config-edgerouter-telegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation


Script that performs a backup of the router configuration automatically and that we can define how often it is repeated, on a Linux server, and sends us a notification by telegram with the result.

Requirements:

  • EdgeRouter 4 Router, valid for 6P (tested with firmware: v2.0.9-hotfix.7)
  • Linux server
  • Telegram account

We connect to the router via ssh

ssh {user}@{ip_router}
sudo bash

Generate ssh key and copy it to the linux server where we are going to save the backups.

ssh-keygen -t rsa -b 4096
...
ssh-copy-id -i .ssh/id_rsa.pub {user}@{ip_server}

Create bot, and get token/chatID bot:

  • botfather
  • myidbot

Change in the file telegram.env, the variables TOKEN and CHAT_ID.

TOKEN={YOUR_TOKEN_TELEGRAM}
CHAT_ID={YOUR_CHAT_ID}

Change in the file backup-config.sh, the variables server_user and server_backup.

server_user={USER_SERVER}
server_backup={IP_SERVER}

Copy files telegram.env and backup-config.sh to the router

/config/ssh-keys/telegram.env
/config/scripts/backup-config.sh
chmod a+x /config/scripts/backup-config.sh

We configure the task and the time we want it to repeat.

configure
set system task-scheduler task backup-conf executable path /config/scripts/backup-config.sh
set system task-scheduler task backup-conf interval {interval}
commit ;save

{interval}

  • none - Execution interval in minutes
  • m - Execution interval in minutes
  • h - Execution interval in hours
  • d - Execution interval in days

example:

set system task-scheduler task backup-conf interval 7d

Capture of the result

About

Script to backup the EdgeRouter configuration, copy it to a linux server and send us a message with the file to Telegram.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages