Community discussions

MikroTik App
 
dravnieks
newbie
Topic Author
Posts: 28
Joined: Sun May 08, 2011 12:11 am
Location: Gorey, Ireland
Contact:

Script to update or create user.

Thu Nov 30, 2017 10:06 pm

Hi!
can someone advice, how to correct following command
######################
#Check for api user
:if ( [/user find where name=api] ) do={
:log info ("api user exists")
}else ={
/ip service set [find name="api"] address=1.1.1.1 disabled=no
/user group add name=api policy="local,read,write,api"
/user add name=api password=password disabled=no group=api
/user set api addres=1.1.1.1
}
#####################
 
User avatar
ADahi
Member Candidate
Member Candidate
Posts: 209
Joined: Thu Sep 21, 2017 7:16 pm
Location: Iraq, Ninavah
Contact:

Re: Script to update or create user.

Wed Dec 06, 2017 6:00 pm

Error there is space after else
 }else ={

the correct grammar space before else
} else={

Who is online

Users browsing this forum: No registered users and 4 guests