scraps
This is an old revision of the document!
Table of Contents
Scraps
Bits and pieces I want to be able to grab quickly. This page will change frequently.
Disable power button shutdown
edit /etc/systemd/logind.conf
uncomment HandPowerKey, set to ignore
Image and Compress Disk
dd if=/dev/sda bs=100M | pv -ptera -s500G | lz4 > backup-name.dd.lz4
(-s500G refers to the image size, for estimates)
Mount the whole disk image: (have to un-lz4 first ofc)
kpartx -a -v myimage.disk mount /dev/mapper/loop0p1 /mnt/myimage
Then, to unmount:
umount /mnt/myimage kpartx -d -v myimage.disk
ntplogtemp
#!/bin/bash /usr/local/bin/ntplogtemp -o -l /chronyLogs/temps sed '/ZONE0/d' -i /chronyLogs/temps sed '/sensor/d' -i /chronyLogs/temps sed -i 's/LM0/CPU/g' /chronyLogs/temps sed -i 's/LM1/CPU/g' /chronyLogs/temps
Quick Pi ID
Easy way to get a quick visual indicator to ID a Pi you're remoted into:
Blink pwr LED at 1Hz:
echo timer | sudo tee /sys/class/leds/led1/trigger
Set pwr LED back to monitor voltage:
echo input | sudo tee /sys/class/leds/led1/trigger
Raspberry Pi Heartbeat
set in config.txt
dtparam=act_led_trigger=heartbeat
chronyc tracking
-m flag combines commands. For example: sources -v, tracking, sourcestats -v
chronyc -m 'sources -v' tracking 'sourcestats -v'
DHCP and Static IP on the same interface
Ubuntu Server 20.04, should apply to netplan in general.
network: version: 2 ethernets: eno1: dhcp4: true addresses: - 172.16.1.20/22 gateway4: 172.16.0.1 nameservers: search: - syninf.net addresses: - 172.16.0.2
Find files under certain size and move them
find . -type f -size -150M -exec mv {} ../junk \;
nmap testers
NTP
sudo nmap -sU -p 123 --script ntp-info 172.16.1.6
DHCP
sudo nmap -sU -p 67 --script=dhcp-discover 172.16.0.2
Standalone certbot DNS
sudo certbot certonly --manual --preferred-challenges dns -d webgis.syninf.net
rsync incremental copy
https://www.redhat.com/sysadmin/sync-rsync
sudo rsync -avuP /mnt/data/media/ /mnt/six/media/
Add NTP Server to PiHole DHCP
echo 'dhcp-option=42,172.16.0.2' | sudo tee /etc/dnsmasq.d/42-pihole-dhcp-ntp.conf
Restart pihole
sudo service pihole-FTL reload
scraps.1669260629.txt.gz ยท Last modified: 2024/11/14 02:30 (external edit)