# SPDX-License-Identifier: AGPL-3.0-or-later
# usage: runs once every 15 seconds unless any args are passed, or we
-# then just runs once. On battery power, run once per minute.
+# then just runs once and have verbose output. On battery power, run
+# once per minute.
if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
esac
+ # this section copied from servicepid()
+ unit=exim4
+ pid=$(systemctl show --property MainPID --value $unit ||:)
+ case $pid in
+ [1-9]*) : ;;
+ *)
+ dir=/sys/fs/cgroup/system.slice
+ if [[ ! -d $dir ]]; then
+ dir=/sys/fs/cgroup/systemd/system.slice
+ fi;
+ pid=$(head -n1 $dir/${unit%.service}.service/cgroup.procs ||:)
+ ;;
+ esac
+ if [[ ! $pid ]]; then
+ chars+=(EXIM)
+ fi
+
+
if [[ -e /a/bin/bash_unpublished/source-state ]]; then
# /a gets remounted due to btrbk, ignore error code for file doesnt exist
source /a/bin/bash_unpublished/source-state || [[ $? == 1 ]]
# allow failure in case there are no snapshots yet.
# shellcheck disable=SC2012
shopt -u nullglob
- files=(/mnt/root/btrbk/$vol.20*)
+ files=(/mnt/o/btrbk/$vol.20*)
shopt -s nullglob
snaps=()
if (( ${#files[@]} )); then
begin=false
+ # todo: make this robust to the case of /a not being mounted
if ! make -C /b/ds -q ~/.local/distro-begin 2>/dev/null || [[ $(<~/.local/distro-begin) != 0 ]]; then
begin=true
fi
elif $end; then
chars+=(DE)
else
+ source /a/bin/ds/script-files
f=~/.local/conflink
# shellcheck disable=SC2043
for _ in 1; do
done
# Just because i forget a lot, -mmin -NUM means files modified <= NUM minutes ago
- if (( fmin < 0 )) && [[ $(find ${all_dirs[@]} -mmin $fmin -type f -print -quit 2>/dev/null) ]]; then
+ if (( fmin < 0 )) && [[ $(find ${all_my_scripts[@]} ${all_dirs[@]} -mmin $fmin -type f -print -quit 2>/dev/null) ]]; then
v conflink newer filesystem files
chars+=(CONFLINK)
break
fi
wait=15
if ! $power; then
+ if systemctl -q is-active bitcoind; then
+ bitcoinoff
+ fi
wait=60
fi