X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=switch-mail-host;h=08e74fc443f771edcbd625547f9eb796b9c08b70;hb=3ca4714d6b02ff279a0c724415f3e0a3a6f49059;hp=fd3d032cce84c34bec53d82b90f430f5bb0a0308;hpb=103a2e153f844343c359882079936b2521c82f15;p=distro-setup diff --git a/switch-mail-host b/switch-mail-host index fd3d032..08e74fc 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -4,7 +4,7 @@ source /usr/local/lib/err usage() { cat </dev/null; then - export XDG_RUNTIME_DIR=/run/user/1000 - bufs="$(emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" + bufs="$(sudo -u iank emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" if [[ $bufs ]]; then echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2 exit 1 @@ -212,8 +217,7 @@ EOF $old_shell bash -s <<'EOF' if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then - export XDG_RUNTIME_DIR=/run/user/1000 - bufs="$(emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" + bufs="$(sudo -u iank emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" if [[ $bufs ]]; then echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2 exit 1 @@ -249,6 +253,10 @@ if ! $mail_only; then fi if $host2_only; then + if [[ $old_hostname != "$MAIL_HOST" ]]; then + m $old_shell systemctl --now disable btrbk.timer + fi + m $new_shell systemctl --now enable btrbk.timer exit 0 fi