What's new

Blocklist ipset logging

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

@Adamm,

I want to create a variable that could be referenced in multiple places, but its value easily changed in one. That would make it easier to change the maxelem value.​

Is this correct ?
Code:
blocklist_maxel=$(( 65536 + 7 ))
if [ "$(ipset -L BLOCKLIST | wc -l)" = "$(blocklist_maxel)" ]; then
 
I think your better off defining 65543 and skipping the math entirely. The math involved will never change, so there is no reason to compute it every time the script runs. Math is more for situations where you are adding/subtracting two values that are non persistent and are potentially different every time the script runs.

Also in your example above you have the usage of $() wrong, $() means execute the code inside the brackets. To print a var you would use $var


Code:
blocklist_maxel="65543"
if [ "$(ipset -L BLOCKLIST | wc -l)" = "$blocklist_maxel" ]; then
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top