From: Ian Kelling Date: Wed, 14 Jul 2021 03:50:14 +0000 (-0400) Subject: fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=7e503c3fbd0b1875e5aff4c0a7949d1f175813ec;p=distro-setup fixes --- diff --git a/brc b/brc index 0debf7d..eb42029 100644 --- a/brc +++ b/brc @@ -637,10 +637,8 @@ eless() { } ccomp less eless eqcat() { - exiqgrep -i | while read -r i; do - hlm exim -Mvh $i - echo - hlm exim -Mvb $i + exiqgrep -i -o 60 | while read -r i; do + hlm exim -Mvc $i echo hlm exigrep $i /var/log/exim4/mainlog | cat ||: done diff --git a/btrfsmaint b/btrfsmaint index b9a00a9..c1e8d06 100755 --- a/btrfsmaint +++ b/btrfsmaint @@ -18,16 +18,15 @@ e() { echo "cron: $*"; "$@"; } check-idle() { export DISPLAY=:0 - # 3 hours, assume a movie might run that long. - idle_limit=$((1000 * 60 * 60 * 3)) + # a hours, a movie could run that long. + idle_limit=$((1000 * 60 * 60 * 2)) idle_time=$idle_limit - id=999 - while id $((++id)) &>/dev/null; do - new_idle_time=$(sudo -u \#$id xprintidle 2>/dev/null) ||: + while read -r user; do + new_idle_time=$(sudo -u $user xprintidle 2>/dev/null) ||: if [[ $new_idle_time && $new_idle_time -lt $idle_time ]]; then idle_time=$new_idle_time fi - done + done < <(users | tr " " "\n" | sort -u) if (( idle_time < idle_limit )); then idle=false else @@ -77,11 +76,20 @@ main() { check-idle fi + tmp=$(mktemp) + fnd="findmnt --types btrfs --noheading" for x in $($fnd --output "SOURCE" --nofsroot | sort -u); do mnt=$($fnd --output "TARGET" --first-only --source $x) [[ $mnt ]] || continue + if ! btrfs dev stats -c $mnt >$tmp; then + if diff -q $mnt/btrfs-dev-stats $tmp; then + diff -u $mnt/btrfs-dev-stats $tmp | mail -s "$HOSTNAME: error: btrfs dev stats -c $mnt" root@localhost + cat $tmp >$mnt/btrfs-dev-stats + fi + fi + if ! $idle; then btrfs scrub cancel $mnt &>/dev/null ||: continue @@ -133,7 +141,7 @@ if $check; then # this is to prevent systemd from filling up the journal for (( runcount=0; runcount < 90; runcount++ )); do main - sleep 20 + sleep 60 done else main diff --git a/distro-begin b/distro-begin index 4cd02df..0e0af0f 100755 --- a/distro-begin +++ b/distro-begin @@ -350,15 +350,15 @@ fi # firefox exists but is 2 versions outdated if isdeb && [[ $(debian-codename) == nabia ]]; then sudo dd of=/etc/apt/preferences.d/nabia-focal-missing <<'EOF' -Explanation: libkf5* are for konsole libilmbase* are needed for emacs -Package: libilmbase-dev libilmbase24 unrar-free pidgin pidgin-* libpurple0 linux-doc p7zip mumble lightdm mate-desktop-environment mate-desktop-environment-* mate-menus mate-panel mate-panel-* mate-session-manager libmate-* ubuntu-mate-default-settings mate-control-center mate-control-center-common gir1.2-matemenu-* lightdm-gtk-greeter liblightdm-gobject-* firefox libfdk-aac1 +Explanation: libilmbase* are needed for emacs +Package: libilmbase-dev libilmbase24 unrar-free pidgin pidgin-* libpurple0 p7zip mumble lightdm mate-desktop-environment mate-menus mate-panel mate-session-manager ubuntu-mate-default-settings mate-control-center mate-control-center-common lightdm-gtk-greeter firefox libfdk-aac1 Pin: release n=focal,o=Ubuntu Pin-Priority: 500 EOF fi # to test when these become available in trisquel, copy the package list, remove the * chars, repaplace PACKAGES below -# for x in PACKAGES do hr; e $x; if [[ $x == *- ]]; then s="^$x"; dpkg -l "$x*" | sed '0,/^+++/d'; else s="^$x\$"; fi; aptitude search "~O Trisquel ~n $s"; done +# for x in PACKAGES; do hr; e $x; if [[ $x == *- ]]; then s="^$x"; dpkg -l "$x*" | sed '0,/^+++/d'; else s="^$x\$"; fi; aptitude search "~O Trisquel ~n $s"; done #### setup firefox backport diff --git a/epanic-clean b/epanic-clean index 35b7258..92bc8d6 100755 --- a/epanic-clean +++ b/epanic-clean @@ -11,6 +11,10 @@ shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4 set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR +debug=false +if [[ $1 ]]; then + debug=true +fi if [[ $EUID != 0 ]]; then s=sudo @@ -20,10 +24,18 @@ if [[ ! -s /var/log/exim4/paniclog ]]; then exit 0 fi +d() { + if $debug; then + printf "%s\n" "$*" + fi + } + while read -r service regex; do found=false wipe=true + d "$service $regex" while read -r d1 d2; do + d "$d1 $d2" found=true tmptime=$(date -d "$d1 $d2" +%s) # dont consider every matching line, just those in > 60 second intervals @@ -39,18 +51,20 @@ while read -r service regex; do jmin="$(date -d @$sec_min "+%F %H:%M:%S")" jmax="$(date -d @$sec_max "+%F %H:%M:%S")" description=$(systemctl cat $service | sed -rn 's/^ *Description=(.*)/\1/p') - regex="^Starting $description" + jrregex="^Starting $description" if [[ $service == spamassassin ]]; then - regex+="\|^spamd: restarting" + jrregex+="\|^spamd: restarting" fi + d "jrregex=$jrregex jmin=$jmin jmax=$jmax" # the sed clears out the initial time and process+pid if ! journalctl -u $service -S "$jmin" -U "$jmax" \ - | sed -r 's/^([^ ]* ){6} //' | grep "$regex" &>/dev/null; then + | sed -r 's/^([^[:space:]]*[[:space:]]+){5}//' | grep "$jrregex" &>/dev/null; then wipe=false break fi done < <(awk "/$regex/ "'{print $1,$2}' /var/log/exim4/paniclog) if $found && $wipe; then + d "wiping $regex" if [[ ! -w /var/log/exim4/paniclog-archive ]]; then $s touch /var/log/exim4/paniclog-archive $s chgrp adm /var/log/exim4/paniclog-archive diff --git a/filesystem/etc/systemd/system/btrfsmaint.service b/filesystem/etc/systemd/system/btrfsmaint.service index 3a899e2..e2937a7 100644 --- a/filesystem/etc/systemd/system/btrfsmaint.service +++ b/filesystem/etc/systemd/system/btrfsmaint.service @@ -3,7 +3,7 @@ Description=btrfsmaint After=multi-user.target [Service] -Type=oneshot +Type=simple ExecStart=/usr/local/bin/sysd-mail-once -1 btrfsmaint /usr/local/bin/btrfsmaint IOSchedulingClass=idle CPUSchedulingPolicy=idle diff --git a/filesystem/etc/systemd/system/btrfsmaint.timer b/filesystem/etc/systemd/system/btrfsmaint.timer index f07fffb..15bc0f6 100644 --- a/filesystem/etc/systemd/system/btrfsmaint.timer +++ b/filesystem/etc/systemd/system/btrfsmaint.timer @@ -2,7 +2,7 @@ Description=btrfsmaint [Timer] -OnCalendar=Tue *-*-* 04:00:00 +OnCalendar=Thu *-*-* 02:00:00 [Install] WantedBy=timers.target diff --git a/gen-amy-fstab b/gen-amy-fstab index 7a1ce46..2c2c91a 100755 --- a/gen-amy-fstab +++ b/gen-amy-fstab @@ -21,6 +21,8 @@ if (( $# != 2 )); then exit 1 fi +# lots of this is taken from default.PARTITION + if (($(nproc) > 2)); then mopts=,compress=zstd fi diff --git a/mount-latest-subvol b/mount-latest-subvol index 5458a95..eadb6c0 100644 --- a/mount-latest-subvol +++ b/mount-latest-subvol @@ -480,6 +480,7 @@ exit $ret # chroot . # apt install grub-efi +# this is taken from partition.DEFAULT # ssds=() # for disk in $(lsblk -do name,tran -n | awk '$2 ~ "^(sata|nvme)$" { print $1 }'); do # case $(cat /sys/block/$disk/queue/rotational) in @@ -490,6 +491,7 @@ exit $ret # esac # done +# this is from /a/bin/fai/fai/config/scripts/GRUB_EFI/10-setup # GROOT=$(grub-probe -tdrive -d ${ssds[@]}) # echo "GROOT=$GROOT" # grub-install --no-floppy --modules=part_gpt "$GROOT" diff --git a/system-status b/system-status index 31d8a12..a1f7b54 100644 --- a/system-status +++ b/system-status @@ -219,9 +219,9 @@ write-status() { maxtime=$t fi done - if (( maxtime < now - 60*60 )); then + if (( maxtime < now - 2*60*60 )); then chars+=("OLD-SNAP") - snapshotmsg="/o snapshot older than 1 hour" + snapshotmsg="/o snapshot older than 2 hours" fi lo -1 old-snapshot $snapshotmsg fi