}
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
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
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
# 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
# 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
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
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
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
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
Description=btrfsmaint
[Timer]
-OnCalendar=Tue *-*-* 04:00:00
+OnCalendar=Thu *-*-* 02:00:00
[Install]
WantedBy=timers.target
exit 1
fi
+# lots of this is taken from default.PARTITION
+
if (($(nproc) > 2)); then
mopts=,compress=zstd
fi
# 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
# 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"
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