3 # We setup kd as a server which runs profanity, because profanity
4 # contains important state which it does not save to disk: the most
5 # recent read message in each chat room and for private messages.
6 # To do this, uses data directories in /d/p.
8 # However, if we need to take kd down for maintenance, we can run
9 # profanity on HOST2 with data directory in /p. To do this, stop
10 # profanity, run prof-backup, and then systemctl start profanity from
11 # HOST2, and then run prof. To connect from other machines, run prof
12 # HOST2_SSH_NAME. To have the profanity service stopped and started with
13 # switch-mail-host, do touch /p/profanity-here. To do the reverse,
15 # systemctl stop profanity
16 # rsync /p/profanity{,-config} kdwg.b8.nz:/d/p
17 # ssh root@kdwg.b8.nz systemctl --now enable profanity
19 if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi
20 source /a
/bin
/bash-bear-trap
/bash-bear
22 source /a
/bin
/bash_unpublished
/source-state
23 if [[ ! $HOSTNAME ]]; then
24 HOSTNAME
=$
(cat /etc
/hostname
)
26 if [[ $HOSTNAME != "$HOST2" ]]; then
32 if systemctl
--quiet is-active profanity
; then
33 rsync
/d
/p
/profanity
{,-config} /p
37 if ssh iank@b8.nz systemctl
--user --quiet is-active profanity
; then
38 rsync
-a b8.nz
:/d
/p
/profanity
{,-config} /p