Certification in ipv6.he.net have daily tests that give on 1 an extra point after passing all the basic tests. They have to be done 100 such tests for maximum score 😐 . The tests themselves are completely trivial

  • Traceroute
  • DIG AAAA
  • DIG PTR
  • Ping
  • Whois

The most unpleasant thing is that the tests themselves must be unique, ie you can't use one domain twice 🙂 Besides everything else, they are a bit annoying 🙄 – no challenge just slapping 5 commands in the cli and copy / paste of the result on their site.

As a lazy and administrator who likes to make his life easier, I quickly scratched an elementary bash that does the dirty work for me.

#!/bin/bash

hr() {
  local start=$'\e(0' end=$'\e(B' line='qqqqqqqqqqqqqqqq'
  local cols=${COLUMNS:-$(tput cols)}
  while ((${#line} < cols)); do line+="$line"; done
  printf '%s%s%s\n' "$start" "${line:0:cols}" "$end"
}

if [ -z $1 ]
then
  echo "Append domain afert the script name!!!"
  exit
fi

IP=$(dig $1 AAAA +short)

if [ -z ${IP} ]
then
  echo "$1 dont have valid IPv6 record"
else
  reset
  traceroute6 $1
  hr
  dig $1 AAAA
  hr
  dig -x ${IP}
  hr
  ping6 -c3 ${IP}
  hr 
  whois ${IP}
fi

As you can see, the script is insanely simple. You submit a domain and then validate it to see if there is an IPv6 record and if so, perform daily tests for it. The coolest part – function hr which prints a line across the entire width of the screen is taken from bash-hackers.

One of the things that annoys me the most is when I copy / move a great director in cli I have no idea what percentage of the total size I have rolled over. Unfortunately, cp / mv do not have such forces and we have to resort to alternatives. There are a lot of possibilities, but I personally like the use of rsync instead of pc / mv. It has everything built-in – preserve rights over files and directories, progress bar as well as the ability to delete copied files.

In general, I did 2 alias that do more than wonderful work:

alias cpi='rsync -a --info=progress2'
alias mvi='rsync -a --info=progress2 --remove-source-files'

I haven't been coding for a long time and I rarely have to pick up any clivs that are not UTF8 encoded. Today I had to quickly review some files and when I opened it almost immediately I wanted to do rm -rf on the folder where they were contained, some stupid individual with half a brain cell has decided to write his comments in Cyrillic. Fortunately, not the super admiral forces solve this misunderstanding of nature with 1 row in cli:

iconv -f cp1251 -t utf8 old_shitty_encoded_file -o new_good_encoded_file

I think the flags themselves speak for themselves, but let's take a quick look at them:

  • -o outputfile
  • -t to-encoding
  • -t to-encoding

iconv has another very nice extra that can transliterate (where possible) by setting -t ASCII // TRANSLIT but unfortunately it does not work with Cyrillic 🙂

Because of some (not very clear reasons to me) I forgot to upgrade the postgresql daemon in the distribution upgrade on one of my Debian servers. The Postgresql daemon has the nice feature of not starting to use its new version (unlike Mysql) until we are convinced, that the new one is fully compatible with the launch – extremely useful in large databases. The update process itself is limited to the following 2 steps:

  • pg_dropcluster
  • pg_upgradecluster

The pg daemon must be stopped before you can drop the cluster!

pg_dropcluster 9.4 main

This command passes quickly, then we move on to the essential part – the upgrade itself

pg_upgradecluster 9.1 main
Disabling connections to the old cluster during upgrade...
Restarting old cluster with restricted connections...
Creating new cluster 9.4/main ...
config /etc/postgresql/9.4/main
data   /var/lib/postgresql/9.4/main
locale en_US.UTF-8
Flags of /var/lib/postgresql/9.4/main set as -------------e-C
port   5433
Disabling connections to the new cluster during upgrade...
Roles, databases, schemas, ACLs...
Fixing hardcoded library paths for stored procedures...
Upgrading database postgres...
Analyzing database postgres...
Fixing hardcoded library paths for stored procedures...
Upgrading database template1...
Analyzing database template1...
Fixing hardcoded library paths for stored procedures...
Upgrading database xpqt...
Analyzing database xpqt...
Re-enabling connections to the old cluster...
Re-enabling connections to the new cluster...
Copying old configuration files...
Copying old start.conf...
Copying old pg_ctl.conf...
Copying old server.crt...
Copying old server.key...
Stopping target cluster...
Stopping old cluster...
Disabling automatic startup of old cluster...
Configuring old cluster to use a different port (5433)...
Starting target cluster on the original port...
Success. Please check that the upgraded cluster works. If it does,
you can remove the old cluster with

pg_dropcluster 9.1 main

If everything went smoothly you should receive a message like the above which prompts you to get rid of the old data from pg.

pg_dropcluster 9.1 main

At the end of this tarpan, you can now start your process again. For me, the bases are small and unfortunately I can't estimate how long the significant upgrade takes..

Today I had to run one fsck on a large RAID array ~ 6TB. In the speed I did not start fsck with the -C option to show me progress and after a modest wait from 2 hours I'm a little tired, that I am unaware of how far the inspection has come. A cool trick for an already launched fsck to visualize the progress bar is:

kill -10 $(pidof fsck.ext3)

You wait a while with me after about 2-3 min a progress bar appeared and showed 49% (kef) more 3 hours of waiting 🙁

Let's summarize what we do we send a signal SIGUSR1 which prompts the fsck to show the progress bar. If we want to stop it for some reason, we have to send it SIGUSR2 or

kill -12 $(pidof fsck.ext3)

Well this is not something super complicated or difficult just a cool trick 🙂