• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved fail2ban issue

Dork

Regular Pleskian
Server operating system version
CentOS 7
Plesk version and microupdate number
18.0.49 Update #2,
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "delete from bans where timeofban < strftime('%s', 'now', '-7 days')"
has no effects
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "vacuum"
doesn't work.
am I doing something wrong?
 
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "delete from bans where timeofban < strftime('%s', 'now', '-7 days')"
has no effects
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "vacuum"
doesn't work.
am I doing something wrong?
Take a look here, it may help you:
 
Take a look here, it may help you:
Sorry - but excactly that doesn't work (see my question)
 
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "delete from bans where timeofban < strftime('%s', 'now', '-7 days')"
has no effects
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "vacuum"
doesn't work.
am I doing something wrong?

Your query seems right, although I haven't tested it. Note that you'll need the run the vacuum command directly after you've ran the query.

What is it you're trying to achieve exactly?
 
Your query seems right, although I haven't tested it. Note that you'll need the run the vacuum command directly after you've ran the query.

What is it you're trying to achieve exactly?
I`m on a virtual Server (Virtuozo) and the limit if numiptent is 2000.
Vey often the server is under havy attack (ssh, postfix) and the numiptent increases (> 2000).
In this case I have to delete the database table and the logfile by hand.
So I want to write a script that read the numiptent and start the "vacuum" if numiptent is > 1900.
The script should start via cronjob.
 
I don't need advice for writing the script - but as long as at least
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "vacuum;"
doesn't work, as long it's useless to write the script
 
I see. What I actually meant to ask was what do you expect the query to do?

The query DELETE FROM bans WHERE timeofban < STRFTIME('%s', 'now', '-7 days') deletes all records (bans) older than 7 days. Do you actually have fail2ban configured with a ban period longer than seven days? If you have shorter ban period there won't be anything in the database to delete when you run that query.
 
I see. What I actually meant to ask was what do you expect the query to do?

The query DELETE FROM bans WHERE timeofban < STRFTIME('%s', 'now', '-7 days') deletes all records (bans) older than 7 days. Do you actually have fail2ban configured with a ban period longer than seven days? If you have shorter ban period there won't be anything in the database to delete when you run that query.
Yes - I know
but
Code:
sqlite3 /var/lib/fail2ban/fail2ban.sqlite3 "vacuum;"
should work independently of the other query - am I rght?
 
No, that's not what vacuum is used for. From How SQLite VACUUM Optimizes Your Database

The SQLite VACUUM command​

The VACUUM command does not change the content of the database except the rowid values. If you use INTEGER PRIMARY KEY column, the VACUUM does not change the values of that column. However, if you use unaliased rowid, the VACUUM command will reset the rowid values. Besides changing the rowid values, the VACUUM command also builds the index from scratch.

It is a good practice to perform the VACUUM command periodically, especially when you delete large tables or indexes from a database.

It is important to note that the VACCUM command requires storage to hold the original file and also the copy. Also, the VACUUM command requires exclusive access to the database file. In other words, the VACUUM command will not run successfully if the database has a pending SQL statement or an open transaction.
 
Last edited:
Yes, that's correct.
So I wil use a customized "delete" command as a part of my script and the "vacuum" command as an addition (in order to optimize the db).
Thanks for your help!

Please mark the thread as resolved.
 
Back
Top