Mode button test internet

Hello,

Brand new to scripting and I wanted to get a second opinion. The script works but I was wondering if there was a better way of doing it.
The script needs to disable and then re-enable PPPoE, check if the internet is working, and then reboot if it can’t get to the internet. Here’s what I have.

/interface disable pppoe-out
:log info message=(“pppoe disabled”);
:delay 5s
/interface enable pppoe-out
:log info message=("pppoe enabled ");
:delay 5s
:if ([/ping 8.8.8.8 interval=5 count=5] =0) do={
log info “internet is down, rebooting” ; /system reboot
} else={
log info “internet is working”
}

It looks like it does what you want, but I have to wonder why you think rebooting the router is the best (or even an effective) way to get the Internet back.

I work for a wisp and the script is included in customer routers as a preliminary troubleshooting step. With previous non-mikrotik routers, reestablishing ppp or rebooting seemed to be an effective first step, so we are wanting to include that process in the Mode button.