systemd suspend/resume script

Had a question the other day; a friend’s laptop would lose the trackpad after resume so his solution was to insert the module manually. Well, systemd has systemd-suspend.service which can handle those events. Details in man systemd-suspend.service

Place a script in /lib/systemd/system-sleep/ and make it executable. Any scripts in that directory will be called upon suspend (passing the parameter pre) and will be called again upon resume (passing the parameter post.) A sample script:

#!/bin/sh
if [ "${1}" = "pre" ]; then
# about to suspend …
echo "suspend event at $(date)…" > /tmp/suspend_test
elif [ "${1}" = "post" ]; then
# about to resume …
echo "resume event at $(date) …" >> /tmp/suspend_test
fi

Now, my keyboard backlight settings get saved and restored correctly on suspend/resume.

END

gigabit switch test

I setup a gigabit switch and wanted to check the transfer rate between 2 linux systems.

1) Using iperf
==============
install iperf on both server and client, sudo apt install iperf

on server: iperf -s
on client: iperf -c server_host
————————————————————
Client connecting to server_host, TCP port 5001
TCP window size: 85.0 KByte (default)
————————————————————
[ 3] local 10.0.0.44 port 36798 connected with 10.0.0.30 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.09 GBytes 939 Mbits/sec

2) Using nc
===========
nothing to install, nc is already installed.

on server: nc -vvlnp 12345 >/dev/null
on client: dd if=/dev/zero bs=1M count=1K | nc -vv server_host 12345

Connection to server_host 12345 port [tcp/*] succeeded!
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 9.16265 s, 117 MB/s

iperf reports 939 Mbits/sec, about same as 117 MB/s (divide 939 / 8 bits/byte)

END

new DNS 1.1.1.1

Cloudflare’s mission is to help build a better Internet and today April 1st, are releasing a new DNS resolver, 1.1.1.1 – a recursive DNS service. This is not an April fool’s joke. Use the following IPv4 addresses for your resolver: 1.1.1.1 and 1.0.0.1. Easy to remember.

https://blog.cloudflare.com/dns-resolver-1-1-1-1/
https://1.1.1.1/