Open abrpr opened 6 years ago
I did it like that :
import routeros_api
import datetime
from scanNmapy import ScanNmapy
ip_list =[]
no_access = []
comunication_error = []
update_time = datetime.datetime(2017, 9, 15, 14, 20)
delta = datetime.timedelta(days=0.0005)
length = len(ip_list)
while length != 1:
length = len(ip_list)
ip = ip_list.pop(0)
time = str(update_time)[11:19]
connection = routeros_api.RouterOsApiPool(ip, username=login, password=password)
try:
api = connection.get_api()
try:
task = api.get_resource('/system/scheduler')
task.add(name='', start_time=time, on_event='system package update check-for-updates' + '\n' + 'system package update download')
task.add(name='reset', start_time='03:00:00', start_date='Sep/18/2017', on_event='system reboot')
except routeros_api.exceptions.RouterOsApiCommunicationError:
comunication_error.append(ip)
connection.disconnect()
print(ip + ' Done')
except routeros_api.exceptions.RouterOsApiConnectionError:
print(ip + ' NOT done')
no_access.append(ip)
update_time = update_time + delta
print('No access :')
print(no_access)
how can i update my mikrotik to last version with this API? it should first download new update with this command
system/package/update download
and then reboot the router