-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·31 lines (26 loc) · 895 Bytes
/
setup
File metadata and controls
executable file
·31 lines (26 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
if [ $# -ne 3 ]
then
echo "Expecting 3 args, the email address to send alerts to and a username and password for the smtp account"
exit 1
fi
admin_email=$1
username=$2
password=$3
echo "dc_eximconfig_configtype='smarthost'
dc_other_hostnames="$(hostname)"
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost='da'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.sendgrid.net:587'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'" | sudo tee /etc/exim4/update-exim4.conf.conf > /dev/null
echo "smtp.sendgrid.net:$username:$password" | sudo tee /etc/exim4/passwd.client > /dev/null
sudo service exim4 restart
cat disk_alert | sed "s/ADMIN_EMAIL=\".*\"$/ADMIN_EMAIL=\"$admin_email\"/" | sudo tee /etc/cron.daily/disk_alert > /dev/null
sudo chmod +x /etc/cron.daily/disk_alert