Version 1 (modified by 4 years ago) (diff) | ,
---|
Mikrotik
Script for checking Internet, VPN
[admin@G01] > /system script print Flags: I - invalid 0 name="script_reboot" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon dont-require-permissions=no last-started=feb/28/2021 16:13:33 run-count=30 source= :if ([/ping 8.8.8.8 count=3 size=64 interval=2s]=0) do={ :log error "LTE DOWN"; /system reboot; } else={ :log info "LTE OK"; } 1 name="check_vpn" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon dont-require-permissions=no last-started=feb/28/2021 16:22:33 run-count=15 source= :if ([/ping 192.168.59.1 count=3 size=64 interval=2s]=0) do={ :log error "----VPN DOWN"; /interface pptp-client set pptp-out1 disabled=yes; /delay 1s; /interface pptp-client set pptp-out1 disabled=no; } else={ :log info "----VPN OK"; } 2 name="check_internet" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon dont-require-permissions=no last-started=feb/28/2021 16:23:33 run-count=29 source= :if ([/ping 8.8.8.8 count=3 size=64 interval=2s]=0) do={ :log error "----Internet DOWN"; /interface lte set numbers=lte1 disabled=yes; /system routerboard usb power-reset duration=1; :log info "---Power USB DOWN ---"; /delay 40s; /interface lte set numbers=lte1 disabled=no; :log info "---Enable lte1 "; } else={ :log info "----Internet OK"; } 3 name="vpn_lossLong" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon dont-require-permissions=no run-count=0 source= :if ([/ping 192.168.59.1 count=10 size=64 interval=5s]=0) do={ :log error "----VPN LOSS LONG DOWN Reboot"; /system reboot; } else={ :log info "----VPN LOSS LONG OK"; } [admin@G01] >