Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Primeiro deve-se montar a URL do backup//
- //subistituir X pelo IP de acesso do seu Controllr//
- http://XXXXXXXXXX:8083/service/mikrotik/index?key=XXXXXXXXX&local_address=XXXXXXX&remote_address=XXXXXXXX
- //Depois vá em System > Scripts
- :global IPCONTROLLR "IPLOCALDOCONTROLLR";
- :global KEY "SUACHAVE";
- :global DEVICE "0";
- :global PPPOE "1";
- :global HOTSPOT "0";
- :global LOCALADDRESS "192.168.1.1";
- :global REMOTEADDRESS "pool-pppoe";
- :global DNSSERVER1 "8.8.8.8";
- :global DNSSERVER2 "8.8.4.4";
- :global done "";
- :log warning "Importando PPPoE";
- /tool fetch mode=http url="http://$IPCONTROLLR:8083/service/mikrotik/index?key=$KEY&device=$DEVICE&local_address=$LOCALADDRESS&remote_address=$REMOTEADDRESS&pppoe=$PPPOE&hotspot=$HOTSPOT&dns_server1=$DNSSERVER1&dns_server2=$DNSSERVER2" src-path=mikrotik.php dst-path=clientsctrl.rsc;
- :set done "true";
- :if ( [/file find name=clientsctrl.rsc] != "" ) do={
- :log warning "Importando PPPoE2";
- /import clientsctrl.rsc;
- /file remove clientsctrl.rsc
- #/ppp secret unset [find where comment=controllr] remote-address;
- /ppp secret set caller-id="" [find comment="controllr"]
- }
- //Depois que substituir os campos corretos clique em Aplly e depois Run Script.
- //Logo após rodar o Script, copie-o e cole em System > Scheduler, marque em Start Time : startup e Interval: 24:00:00
- netwatch via script
- /tool netwatch
- add comment=CTLR-BACKUP down-script=":log info \"IP do Controllr off habilitando as secrets\"\r\
- \n/ppp secret set [find comment=controllr] disabled=no" host=192.168.10.5 interval=2m up-script=":log info \"Desabilitando as Secrets do Controllr\"\r\
- \n/ppp secret set [find comment=controllr] disabled=yes\r\
- \n:delay 3m\r\
- \n:log info \"Removendo Secrets com o Comentario controllr\"\r\
- \n/ppp active remove [find where comment=controllr]"
- #########################Build 2.0####################
- {
- :global IPCONTROLLR "192.168.142.22";
- :global KEY "321351321";
- :global DEVICE "0";
- :global DHCP "1";
- :global PPPOE "0";
- :global HOTSPOT "0";
- :global IPMAC "0";
- :global WIRELESS "1";
- :global LOCALADDRESS "192.168.140.1";
- :global REMOTEADDRESS "pool-test-net";
- :global REMOTEBLOCK "pool-test-block";
- :global IPV6PXENA "pool-v6-px";
- :global IPV6PDENA "pool-v6-pd";
- :global DNSSERVER1 "8.8.8.8";
- :global DNSSERVER2 "8.8.4.4";
- :global done "";
- :global FILEPATH "controllr-backup.rsc";
- :log warning "CTLR - Iniciando Backup";
- :delay 3s;
- :if ([/file find name=$FILEPATH] != "") do={:log warning "CTLR - Apagando Backup Antigo $FILEPATH"; /file remove $FILEPATH;} else={:log warning "CTLR - Não existe nenhuma Backup antigo"};
- :delay 3s;
- :log warning "CTLR - Baixando Backup $FILEPATH";
- :delay 3s;
- /tool fetch mode=http url="http://$IPCONTROLLR:8083/service/mikrotik/backup?key=$KEY&device=$DEVICE&local_address=$LOCALADDRESS&remote_address=$REMOTEADDRESS&remote_block=$REMOTEBLOCK&ipv6_px_enable=$IPV6PXENA&ipv6_pd_enable=$IPV6PDENA&pppoe=$PPPOE&dhcp=$DHCP&hotspot=$HOTSPOT&ipmac=$IPMAC&wireless=$WIRELESS&dns_server1=$DNSSERVER1&dns_server2=$DNSSERVER2" src-path="$FILEPATH" dst-path="$FILEPATH";
- :delay 3s;
- :set done "true";
- :delay 3s;
- :log warning "CTLR - Conferindo Backup $FILEPATH";
- :delay 3s;
- :if ( [/file find name="$FILEPATH"] !="" ) do={:log warning "CTLR - Importando Backup $FILEPATH"; /import $FILEPATH; } else={:log warning "CTLR - Não tem num Backup de importacao, revise o script"};
- }
Add Comment
Please, Sign In to add comment