13 февр. 2025 г.

Mysql/MariaDB table delete records by schedule

 1. /root/cleanup_records.sql

use DATABASE_NAME;
delete from TABLE_NAME where `DATE_FIELD` < DATE_SUB(CURDATE(),INTERVAL 3 MONTH);

2. crontab -e (/var/spool/cron/crontabs/root)


# m h  dom mon dow   command
0 0 * * * mysql -uroot <~/cleanup_records.sql

25 янв. 2025 г.

ufw cheatsheet

ufw disable/enable
ufw status verbose
ufw status numbered
ufw delete NUM
ufw delete deny NUM
ufw insert 1 deny in from XXX.XXX.XXX.XXX to any port 25 proto tcp
ufw app info 'OpenSSH' (see /etc/ufw/applications.d)
ufw allow proto tcp from XXX.XXX.XXX.XXX/24 to any port YYYY 
ufw reload (to apply rules)
ufw allow in on eth0 to any port 22
ufw logging on/off/low/medium/high/full
fot NAT - /etc/ufw/before.rules
ufw allow 22/tcp comment 'open port 22 for ssh'
ufw allow <PORTFROM>:<PORTTO>/udp