{"id":13587901,"url":"https://github.com/volkovro/mikrotik-backups","last_synced_at":"2025-04-08T02:34:12.247Z","repository":{"id":83962426,"uuid":"237159303","full_name":"volkovro/mikrotik-backups","owner":"volkovro","description":"Mikrotik centralized backup script","archived":true,"fork":false,"pushed_at":"2021-04-18T22:21:02.000Z","size":41,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-26T11:08:10.962Z","etag":null,"topics":["bash","bash-script","mikrotik","python","python3","routeros","routers"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/volkovro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-30T07:15:40.000Z","updated_at":"2024-08-01T16:33:53.222Z","dependencies_parsed_at":"2023-03-02T16:01:03.118Z","dependency_job_id":null,"html_url":"https://github.com/volkovro/mikrotik-backups","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volkovro%2Fmikrotik-backups","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volkovro%2Fmikrotik-backups/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volkovro%2Fmikrotik-backups/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/volkovro%2Fmikrotik-backups/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/volkovro","download_url":"https://codeload.github.com/volkovro/mikrotik-backups/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247765013,"owners_count":20992214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","mikrotik","python","python3","routeros","routers"],"created_at":"2024-08-01T15:06:24.997Z","updated_at":"2025-04-08T02:34:12.010Z","avatar_url":"https://github.com/volkovro.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Mikrotik centralized backup script\n### For computers running GNU/Linux\n### This project is intended for centralized management backups of devices running router_os (Mikrotik routers and other)\n\n\n***This is my first project, do not judge strictly***\n\n***\n***\n### Properties:\n* Version control\n* Sending notifications to the Telegram messenger\n* All backups (\".backup\" and \".rsc\") are archived in one place\n* You can adapt this project to the devices of any vendor\n\n***\n### How to use it?\n\u003e If there is no time to read, then briefly:\n\u003e\n\u003e A file with the \".sh\" extension is the main script, it is you who will run it,\n\u003e\n\u003e and the \".py\" file will allow you to add new routers to your script.\n\u003e\n\u003e The example file contains comments that will help you understand how this script works.\n***\n\n1. Check that you have all the necessary installed\n\n`   $   sudo apt-get install openssh-server openssh-client scp sshpass curl zip python3`\n\n2. Open \"Mikrotik_backuper.sh\"\n3. Find the lines \"`DIR=`\",\"`LGIN=`\",\"`PRT=`\"\n4. Enter the directory where your backups will be synchronized (with a slash at the end),\n   your login on the routers and the port, respectively\n\n***This is almost enough to start making backups***\n\n##### Version control:\n1. Find the line \"`#SHELF=`\"\n   Remove `#` at the beginning and specify (in days) the expiration date of backups\n2. In function `archandel`, uncomment the following lines\n   `#    echo \"`\n   `#    search and delete old versions\"`\n   `#    find \"$DIR\"2* -mtime +$SHELF -delete`\n\n***archives older than the specified period will be deleted each time the script is run***\n##### Telegram alerts:\n1. Find the line at the end of the file `##### TELEGRAM ALERT SETTINGS #####` and delete all the first `#` below\n   It should turn out:\n      \n      `TOKEN=`\n      \n      `IDCHAT=`\n      \n      `URL=\"https://api.telegram.org/bot$TOKEN/sendMessage\"`\n      \n      `#PROXYSOCKS=`\n      \n      `#TGMESS=\"curl --silent --show-error --fail -k -G -o /dev/null -x socks5://${PROXYSOCKS} ${URL} -d chat_id=${IDCHAT} \"`\n      \n      `TGMESS=\"curl --silent --show-error --fail -k -G -o /dev/null $URL -d chat_id=$IDCHAT \"`\n      \n      `Function alerts`\n      \n      `function alert {`\n      \n      `echo \"  _______________________________`\n      \n      `Alerts are generated\"`\n      \n      `if [ \"$statsave\" = \"$gg\" ]`\n      \n      `then`\n      \n      `$TGMESS --data-urlencode \"text=Creation of backups $DATE was successful\"`\n      \n      `echo \"END`\n      \n      `_______________________________\"`\n      \n      `else`\n      \n      `$TGMESS --data-urlencode \"text=An error occurred while creating backups, check the $DATE log\"`\n      \n      `echo \"END`\n      \n      `_______________________________\"`\n      `fi`\n      \n      `}`\n      \n      `#####_________________________#####`\n      \n      `alert \u003e\u003e $DIR$DATE.log`\n\n2.Enter the bot token in `TOKEN=` and ID your chat in `IDCHAT=`. Depending on how you will connect to the Telegram API, comment out (uncomment and enter) the necessary variables\n\n***Now, every time you run the script, your bot will tell you how it went***\n\n\n\u003eSee an \"Example_code\" if you have any questions.\n\u003e\n\u003eUsing the \"Supplementer.py\" add new routers to the main script. With the help of utility \"cron\" you can automate the launch of the script.  \n\u003e\n\u003eThe log and archive with backups will be stored in the folder you specified.  \n\u003e\n\u003ePlease note that you should not use this script at the border of the day, as the names use the date (and yes, check it on your device before using the script)\n\n---\n#### P.S.:\n\u003e\n\u003e When I wrote this script, I assumed that you had previously connected via ssh to your devices, but if you hadn’t done this before, connect to it before adding a new device to the script.\n\u003e\n\u003e This is necessary in order to answer yes to the following question:\n\u003e\n\u003e `RSA key fingerprint is SHA256:Oa00aaaaAA0Aa00AAaa0a/AaaaAAaaaAA0AAAaa0aaa.\nAre you sure you want to continue connecting (yes/no)?`\n\n***\n##### ***LICENSE MIT ©***\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolkovro%2Fmikrotik-backups","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvolkovro%2Fmikrotik-backups","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvolkovro%2Fmikrotik-backups/lists"}