fix btrbk service
[distro-setup] / primary-setup
1 #!/bin/bash
2
3 # usage $0 [MAIL_HOST]
4
5 set -eE -o pipefail
6 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
7
8 # setup things which involve being the primary host or not
9
10 if [[ $1 ]]; then
11 new_host=$1
12 sed -ri "s/MAIL_HOST=.*/MAIL_HOST=$new_host/" /a/bin/bash_unpublished/source-semi-priv
13 source /a/bin/bash_unpublished/source-semi-priv
14 fi
15
16 if [[ $HOSTNAME == $MAIL_HOST ]]; then
17 # arbtt disabled for now
18 #DISPLAY=:0 arbtt-capture --sample-rate=10 &
19 sudo systemctl start rss2email.timer
20 sudo systemctl enable rss2email.timer
21
22 else
23 sudo systemctl stop rss2email.timer
24 sudo systemctl stop rss2email.service
25 sudo systemctl disable rss2email.timer
26 # arbtt disabled for now
27 # for ((i=0; i<10; i++)); do
28 # killall arbtt-capture || break
29 # sleep 1
30 # if [[ $i == 9 ]]; then
31 # exit 1
32 # fi
33 # done
34 fi
35
36 mail-setup exim4
37 exit 0
38 :