Answer the question
In order to leave comments, you need to log in
How to execute multiple commands in a row in mikrotik script?
I am writing a script that sends a notification to the mail when the route changes, but only the first command is always executed. What could be the problem?
/ip route set [/ip route find dst-address=0.0.0.0/0] gateway=99.99.99.99
/tool e-mail send server=192.168.1.1 port=25 [email protected] password=PASSWORD to= [email protected] from="ROBOT" \
subject="MikroTik: $[/system clock get date], $[/system clock get time]" \
body="MAIN CHANNEL\nDate: $[/system clock get date ]\nATime: $[/system clock get time]";
Answer the question
In order to leave comments, you need to log in
It's like in the Linux terminal:
If the commands must be run in turn, then at the end of each command you need to put a semicolon ";"
If you need dependent command execution, then you need to put "$$" or "||", which means logical AND and OR.
If you need simultaneous execution of commands, then a single "&" is placed at the end.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question