Community discussions

MikroTik App
 
DerSchlumpf
just joined
Topic Author
Posts: 1
Joined: Thu Aug 27, 2020 10:21 am

Answer interactive prompt from within script

Thu Aug 27, 2020 10:29 am

Hello, is there any chance to answer an interactive prompt from within a script?
[user@mikrotik] > ip ssh import-host-key private-key-file=flash/id_rsa_mikrotik
This will replace current SSH host key, yes? [y/N]:

[user@mikrotik] > system reset-configuration  
Dangerous! Reset anyway? [y/N]: 

Best regards
 
vanes
just joined
Posts: 1
Joined: Mon Oct 19, 2020 9:50 pm

Re: Answer interactive prompt from within script

Thu Feb 18, 2021 10:37 pm

Hello DerSchlumpf,
I was looking for an answer on your question too.
The solution is straightforward. Just add a
y
on a new line to your script.

/system script
add dont-require-permissions=no name=reset-to-base-config owner=admin policy=reboot,write,policy source="/system reset-configuration keep-users=yes no-defaults=yes skip-backup=yes run-after-reset=flash/base-config.rsc\r\ny"

Who is online

Users browsing this forum: No registered users and 29 guests