INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / Thingiverse / RSS / GPG

How to create docker volume from directory

№ 11114 В разделе "Sysadmin" от October 6th, 2020,
В подшивках: ,

Typically its not useful because you can directly mount directory to containers, but… who knows? May be you just want it.

For example, you have directory on your hard drive and want to move files inside docker volume:

root@boroda:/tmp/future-volume# find .

Just run move (or copy) command in busybox container:

docker run --rm -it \
    -v my-docker-volume:/destination \
    -v /tmp/future-volume:/source \
    busybox \
    /bin/sh -c "mv /source/* /destination/ && find /destination"

This command mounts (or create if not exists already) volume, mount directory on disk and move files from disk to volume.

After move completion you’ll see tree on moved files:


That’s all, easy.

Нет комментариев »

Dimming display under Ubuntu Linux

№ 11106 В разделе "Sysadmin" от September 17th, 2020,
В подшивках:

NOT COMPATIBLE WITH REDSHIFT! Turn it off completely, not just disable.

Easiest way:

sudo add-apt-repository ppa:apandada1/brightness-controller
sudo apt-get update
sudo apt-get install brightness-controller-simple

Not easiest way:

xrandr -q | grep " connected"
xrandr --output HDMI-0 --brightness 0.5

Нет комментариев »

Wireguard VPN between Mikrotik and my android phone (without changing firmware to openwrt!)

№ 11088 В разделе "Sysadmin" от September 1st, 2020,
В подшивках: ,

At last, Mikrotik released version 7.1b with Wireguard support! YES!

You can upgrade your device now by switching to development branch.

So, create new wireguard interface, keys and set port.

Assign IP address to your new interface

[admin@MikroTik] > /ip address
[admin@MikroTik] /ip/address> add address= interface=wgvpn

On your mobile phone install Wireguard client and make same steps, assign IP address in same subnet, use public key of your Mikrotik.

Now on Mikrotik create new peer with public key of your phone

Check it

[admin@MikroTik] /ip/address> /tool/ping
  SEQ HOST                                     SIZE TTL TIME  STATUS             
    0                                 56  64 126ms
    1                                 56  64 52ms 
    2                                 56  64 80ms 
    sent=3 received=3 packet-loss=0% min-rtt=52ms avg-rtt=86ms max-rtt=126ms 

Allow connections

In absolutely same way you can set up private network on your computer.

Нет комментариев »

Compare Postgresql tables by records count in tables

№ 11080 В разделе "Sysadmin" от July 16th, 2020,
В подшивках: ,

You have servers with master-slave(s) replication and want to be sure what all tables is synced. Program queries count of records for every table in database and shows to you on screen. Used on servers with logical replication and wal-g.

Create config.yaml with connection strings:

  master: postgres://
  slave_logical: postgres://
  slave_walg: postgres://

Sample output, table ga is out of sync on slave_walg:

2020/07/16 05:45:45 master successfully connected!
2020/07/16 05:45:46 slave_logical successfully connected!
2020/07/16 05:45:46 slave_walg successfully connected!
2020/07/16 05:45:46 Table name: ga
2020/07/16 05:46:07 Postgres name: master Count: 25381158
2020/07/16 05:45:51 Postgres name: slave_logical Count: 25381158
2020/07/16 05:46:06 Postgres name: slave_walg Count: 25342939
2020/07/16 05:46:07 ------------

Source code and install

Нет комментариев »


Fortune cookie: Today's spam: Never hear: "Too short!"