Page 1 of 1
Set simple queue entry if condition is met.
Posted: Sat Sep 17, 2022 5:11 am
by ljb
My mind is going round and round in circles because it does not seem to honour the condition "max-limit not equal to 1024k/1024k.
:if ([/queue simple find name=queue10] max-limit!=1024k/1024k) do={ /queue simple set [find name="queue10"] max-limit=1024k/1024k } else= { :put "no action" }
For the sake of sanitising the log feed, I am attempting to only action when current settings does not match the new.
Where am I going wrong?
LJB
Re: Set simple queue entry if condition is met. [SOLVED]
Posted: Sat Sep 17, 2022 9:30 am
by Jotne
You where close:
{
/queue simple
:if ([find where name=queue10 max-limit!="1024k/1024k"]) do={
set [find name="queue10"] max-limit="1024k/1024k"
} else={
:put "no action"
}
}
First { and last } are not needed in script. Just to get working in copy past terminal.
Also better to use multiple lines instead of one long line with all in one go.
You can also make a foreach loop to go through many queues to change all.
Re: Set simple queue entry if condition is met.
Posted: Sat Sep 17, 2022 10:20 am
by rextended
Sorry, but no... Do not be influenced on what the user write...
(this version do not give errors if queue10 do not exist or is removed later)
/queue simple set [find where name="queue10" and max-limit!="1024k/1024k"] max-limit="1024k/1024k"
Re: Set simple queue entry if condition is met.
Posted: Sat Sep 17, 2022 11:06 am
by Jotne
Shortening it down as always
Re: Set simple queue entry if condition is met.
Posted: Sat Sep 17, 2022 3:52 pm
by ljb
Jotne, rextended - the names I see time and time again in forum posts - thank you for your swift response.
It appears that the omission of the "where" word was my failure for predictable results. A word I see all too often in sql.
Sometimes it takes a little bump like this to get back on track.