howto supress confirmation for reboot via script

I have following script

/system reboot
OR
/system reboot;

but when i execute this script manually it asks for confirmation. how can I auto input Y so that i dont have to press key manually?
Task is to reboot mikrotik from the script ON DEMAND (from the linux ssh execution, i can successfully ssh and run the script, but it dont restart probably dueto confirmation pending)

any solution?

I was in the same situation few days before (on 5.x series)
The workaround I used was following

1- Create simple script name ‘reboot-mt-on-demand’ with following contents

/system scheduler enable reboot-mt-on-demand

2- Create an scheduler with following command (by default it will be disabled all the time)

add disabled=yes interval=1s name=reboot-mt-on-demand on-event="/system scheduler disable reboot-mt-on-demand;\r\
    \n/system reboot;" policy=reboot,read,write,policy,test,password,sniff,sensitive start-date=jan/01/1970 start-time=00:00:00

Now whenever you want to reboot mikrotik, you just execute command and it will reboot the router without any confirmation as you required !

/system script run reboot-mt-on-demand

This will enable the scheduler which will immediately disable the scheduler again and reboot, so that when router reboots the scheduler should be kept disabled. and if you want to execute it from linux (you should first enable the password less ssh login) use following command

ssh -q -p $PORT admin@$MIKROTIKIP /sys scheduler enable reboot-mt-on-demand

I use it to reboot remote mikrotik if required by sending SMS to my linux base system, which receives sms along with my passcode, and then ssh to mikrotik, send warning sms to admin about reboot, log event, send email, and reboot :slight_smile:
I wrote about it in details at my blog.