Install an individual set on NetBSD

Save your settings, and run commands like this to install a single set to your system:

- save your settings first
# tar -cvJpf etc.tar.xz /etc
# tar -Jxvpf base.tar.xz -C /
- do the same with other sets except for etc and xetc

# etcupdate -av -s etc.tar.xz -s xetc.tar.xz
# postinstall fix

Then reboot to be on the safe side.

Fekete Zoltán Wed, 05/22/2019 - 10:29
Setting procmail to mark email as read
You may have incoming emails in your box which should be "marked as read" by default. Spam messages for example. Read below how to do it on the server side.
Fekete Zoltán Wed, 05/22/2019 - 10:23
Rebuild installed packages for a certain host in pkgsrc

You have a machine (a master host) with several idividually installed packages. You want those packages to be rebuilt somewhere else (slave host). Do this:

1. On the master host
# pkg_info -Q PKGPATH -a > pkgs_i_want_to_have
2. Copy the generated file to the slave host, and issue as root:
# cat pkgs_i_want_to_have | (while read pp ; do cd /usr/pkgsrc/$pp ; make && make install ; done)

Simple enough, eh?

Fekete Zoltán Tue, 04/30/2019 - 09:23
SMTP TLS test with openssl
openssl s_client -starttls smtp -crlf -connect mail.mysite.com:25
Fekete Zoltán Wed, 01/16/2019 - 19:14
netstat

Use this command to list all listening IPV4 ports with ip and port numbers:

$ netstat -anl -f inet
Fekete Zoltán Wed, 01/16/2019 - 11:48
rsyslog loses some messages
You write your good program to use the rsyslogd installed on your system. You would have a bunch of log lines, but you can't see any. Check this:
Fekete Zoltán Tue, 12/04/2018 - 07:35

Extract one database from mysql/mariadb full dump

Submitted by Fekete Zoltán on Thu, 07/26/2018 - 13:51

Save this script into an sh file:

#!/usr/bin/env bash

DBNAME=$1
INFILE=$2

SED_FILTER="/^-- Current Database: \`$DBNAME\`/,/^-- Current Database: /p"

sed -n "$SED_FILTER" $INFILE > $DBNAME.sql

echo "Dump is ready: $DBNAME.sql"

exit 0


Run as :

$ sh script_name dbname full_dump_file

If you want to avoid problems during foreign key imports, then insert this line into the newly generated file after the USE <DBNAME>; statement:

SET FOREIGN_KEY_CHECKS=0;