[[scraps]]

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

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.txt · Last modified: 2022/04/20 13:19 by john
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0