add-geoip-il-address-list-updater.rsc
· 1.3 KiB · Text
Ham
:do {
:local scriptFound [:len [/system script find where name=UpdateGeoIP_IL]];
:local schedulerFound [:len [/system scheduler find where name=UpdateGeoIPSchedule]];
:log info "Debug step 1"
:if ( $scriptFound = 0 ) do={
/system script add dont-require-permissions=no name=UpdateGeoIP_IL owner=eliezer policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="{\r\
\n\t:local geoipILUrl \"https://www.ngtech.co.il/geoip/geoip_il.cidr_geoip_update.rsc\";\r\
\n\t/tool fetch mode=https url=\$geoipILUrl;\r\
\n\t:delay 2s;\r\
\n\t/import file-name=geoip_il.cidr_geoip_update.rsc;\r\
\n\t:delay 20s;\r\
\n\t/file remove geoip_il.cidr_geoip_update.rsc;\r\
\n}"
}
:log info "Debug step 2"
:if ($schedulerFound = 0) do={
/system scheduler add disabled=no interval=1d name=UpdateGeoIPSchedule on-event="/system script run UpdateGeoIP_IL;" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=\
1970-01-01 start-time=01:00:00
}
} on-error={
:log warning "Error while installing UpdateGeoIP_IL scripts"
}
| 1 | :do { |
| 2 | :local scriptFound [:len [/system script find where name=UpdateGeoIP_IL]]; |
| 3 | :local schedulerFound [:len [/system scheduler find where name=UpdateGeoIPSchedule]]; |
| 4 | |
| 5 | :log info "Debug step 1" |
| 6 | :if ( $scriptFound = 0 ) do={ |
| 7 | /system script add dont-require-permissions=no name=UpdateGeoIP_IL owner=eliezer policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="{\r\ |
| 8 | \n\t:local geoipILUrl \"https://www.ngtech.co.il/geoip/geoip_il.cidr_geoip_update.rsc\";\r\ |
| 9 | \n\t/tool fetch mode=https url=\$geoipILUrl;\r\ |
| 10 | \n\t:delay 2s;\r\ |
| 11 | \n\t/import file-name=geoip_il.cidr_geoip_update.rsc;\r\ |
| 12 | \n\t:delay 20s;\r\ |
| 13 | \n\t/file remove geoip_il.cidr_geoip_update.rsc;\r\ |
| 14 | \n}" |
| 15 | } |
| 16 | :log info "Debug step 2" |
| 17 | |
| 18 | :if ($schedulerFound = 0) do={ |
| 19 | /system scheduler add disabled=no interval=1d name=UpdateGeoIPSchedule on-event="/system script run UpdateGeoIP_IL;" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=\ |
| 20 | 1970-01-01 start-time=01:00:00 |
| 21 | } |
| 22 | |
| 23 | } on-error={ |
| 24 | :log warning "Error while installing UpdateGeoIP_IL scripts" |
| 25 | } |
| 26 |