beeyev / Mikrotik-RouterOS-automatic-backup-and-update

Script sends backups to email and keep your mikrotik firmware up to date.
MIT License
442 stars 83 forks source link

update doesn't work #3

Closed adv2020 closed 4 years ago

adv2020 commented 4 years ago

The script doesn't update the firmware. I receive the message "If you have not received second email in the next 5 minutes, then probably something went wrong." and I don't receive the second mail and the firmware is not updated.

beeyev commented 4 years ago

Look into your device log, what does it say ?

adv2020 commented 4 years ago

The last two lines in the log: Bkp&Upd: script "Mikrotik RouterOS automatic backup & update" completed it's job. sent <Bkp&Upd: Backup completed - MikroTik. New RouteOS is going to be installed! v.6.45.7-> v.6.46.4>to xxxxx@xxxx

beeyev commented 4 years ago

did you set a correct name to the script ? it has to be BackupAndUpdate

adv2020 commented 4 years ago

Yes. The script partially works. It sends the backup files, but it doesn't update the firmware.

beeyev commented 4 years ago

The script was updated, try again please.

adv2020 commented 4 years ago

Still doesn't work. I have the same behavior. Do you think it has to be related to some Mikrotik models? I'm testing it on a RouterBOARD D52G-5HacD2HnD-TC

adv2020 commented 4 years ago

Here are the last lines of the log; 08:12:12 script,info Bkp&Upd: script "Mikrotik RouterOS automatic backup & update" started. 08:12:12 script,info Bkp&Upd: Performing the first step. 08:12:12 script,info Bkp&Upd: Creating system backups. 08:12:12 script,info Bkp&Upd: System backup created. MikroTik...v6.45.7.stable.2020apr11-081212.backup 08:12:15 script,info Bkp&Upd: Config file was exported. MikroTik...v6.45.7.stable.2020apr11-081212.rsc 08:12:15 script,info Bkp&Upd: Checking for new RouterOS version. Current version is: 6.45.7 08:12:21 script,info Bkp&Upd: New RouterOS is available! 6.46.5 08:12:21 script,info Bkp&Upd: Sending email with backups in attachment. 08:12:26 script,info Bkp&Upd: script "Mikrotik RouterOS automatic backup & update" completed it's job.\r 08:12:26 script,info 08:12:41 e-mail,info sent <Bkp&Upd: Backup completed - MikroTik. New RouterOS is going to be installed! v.6.45.7 -> v.6.46.5> to xxxxx@xxxx

adv2020 commented 4 years ago

I tested the script on a 2011L model and it worked. So the problem is with RouterBOARD D52G-5HacD2HnD-TC.

4ingiz commented 4 years ago

I got this problem too. But I fix it. If you add “:delay 15s;” at line 297 it start work ok. It’s because “[/tool e-mail get last-status]“ return “in progress”. But after add delay it’s return "succeeded"

У меня так же появилась такая проблема через 2 месяца после использования. “[/tool e-mail get last-status]“ возвращал статус “in progress”. После добавления задержки 10-15 сек в строке 297, стало работать нормально. Скрипт быстрее доходила до строки 299 чем система отправляла письмо и давала статус "succeeded"

beeyev commented 4 years ago

I got this problem too. But I fix it. If you add “:delay 15s;” at line 297 it start work ok. It’s because “[/tool e-mail get last-status]“ return “in progress”. But after add delay it’s return "succeeded"

У меня так же появилась такая проблема через 2 месяца после использования. “[/tool e-mail get last-status]“ возвращал статус “in progress”. После добавления задержки 10-15 сек в строке 297, стало работать нормально. Скрипт быстрее доходила до строки 299 чем система отправляла письмо и давала статус "succeeded"

There was a delay for a 5 seconds, but as appeared it was not enough. I have changed this delay to the 30s in a new commit, just to be sure. Thank you for your investigation! I really appreciate that!

adv2020 commented 4 years ago

I confirm it works now! Thanks for sharing!

beeyev commented 4 years ago

Yes, I have rewritten the whole script.