script to reboot a Mikrotik - how ? no longer rebooting ?

script to reboot a Mikrotik - how ? no longer rebooting ?

Would somebody please help me ?

I have a script that is called from netwatch when something no longer pings.
I have used this script for many years.
I just noticed that it is no longer working - (but it used to work on older versions of ROS)

I am currently running 6.37.1
My script contains the following (the script that used to work).
some stuff in the script
:log info “-----> Rebooting in 15 seconds”;
:delay 5;
/file print file=ScriptRebootReason
/file set ScriptRebootReason.txt contents=“Rebooted by Toms script on $[/system clock get date] at $[/system clock get time]”
:log error “-----> Rebooting in 10 seconds”;
:delay 5;
:log error “-----> Rebooting in 5 seconds”;
:delay 5;
:log error “-----> Rebooting now”;
:delay 1;
/system reboot
/system reboot
/system reboot
/system reboot

}

Note: the log error portion of the above script is working - I see the lines showing up in my log. However - the Mikrotik will not reboot.

Note: when I go CLI prompt (via telnet/ssh or the winbox-New-Terminal and I paste in
/system reboot
/system reboot
/system reboot
/system reboot
The Mikrotik will reboot.

However when this is in a script, The Mikrotik will not reboot.

Their appears to be nothing to support something like a " /system reboot -y " or a " /system reboot -noquery "

So - does anybody have a solution ?
Thank you

North Idaho Tom Jones

Hi,
I got simmilar problem. Chech permissions policies for scripts, in my case the scheduler had less permissions than script itself and thus the script was not executed.
L.

I will check

  • I do know the my Netwatch does start the script when something does not ping
  • I do know the script is running because the script writes to a file (the file remains after a reboot/power-cycle)
  • I do now know if there is a possible permission issue with the script calling a reboot ???

North Idaho Tom Jones

Hi there.
I’m an absolute novice with RouterOS, so please take my suggestion with care.
I had similar problem with a RB750 command and seems that the issue was due to the y/N answer to be given after execution of the command.
I solved it just adding end-of-command code “;”
Hope could be useful otherwise, let me know the answer! :unamused: