Community discussions

MikroTik App
 
User avatar
TomjNorthIdaho
Forum Guru
Forum Guru
Topic Author
Posts: 1493
Joined: Mon Oct 04, 2010 11:25 pm
Location: North Idaho
Contact:

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

Thu Oct 13, 2016 11:13 pm

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
 
MedVed01
just joined
Posts: 3
Joined: Thu Oct 20, 2016 10:22 pm

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

Thu Oct 20, 2016 10:30 pm

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.
 
User avatar
TomjNorthIdaho
Forum Guru
Forum Guru
Topic Author
Posts: 1493
Joined: Mon Oct 04, 2010 11:25 pm
Location: North Idaho
Contact:

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

Fri Oct 21, 2016 3:48 am

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
 
mikrobot
just joined
Posts: 4
Joined: Wed Oct 19, 2016 12:36 pm

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

Tue Nov 01, 2016 9:00 pm

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! :roll:

Who is online

Users browsing this forum: No registered users and 37 guests