Update install.sh
This commit is contained in:
parent
36c132b319
commit
0c2d58e93a
1 changed files with 11 additions and 4 deletions
15
install.sh
15
install.sh
|
@ -1,15 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -u
|
set -u
|
||||||
DOMAIN=$1
|
DOMAIN=$1
|
||||||
USER=$2
|
MAILUSER=$2
|
||||||
PASS=$3
|
PASS=$3
|
||||||
|
FROM=$4
|
||||||
if [[ -z "$DOMAIN" ]]; then
|
if [[ -z "$DOMAIN" ]]; then
|
||||||
echo "Must provide Domain as 1st argument" 1>&2
|
echo "Must provide Domain as 1st argument" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$USER" ]]; then
|
if [[ -z "$MAILUSER" ]]; then
|
||||||
echo "Must provide User as 2nd argument" 1>&2
|
echo "Must provide Mail User (user@domain) as 2nd argument" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -18,12 +19,18 @@ if [[ -z "$PASS" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$FROM" ]]; then
|
||||||
|
echo "Must provide From Name as 4th argument" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
apt-get -y install ssmtp
|
apt-get -y install ssmtp
|
||||||
sed -i -e 's/=mail$/=mail.neshweb.net:587/' /etc/ssmtp/ssmtp.conf # replace 'mail' mailhub with actual mailserver
|
sed -i -e 's/=mail$/=mail.neshweb.net:587/' /etc/ssmtp/ssmtp.conf # replace 'mail' mailhub with actual mailserver
|
||||||
sed -i -e 's/hostname=.*/hostname='"$DOMAIN"'/' /etc/ssmtp/ssmtp.conf # replace hostname with actual domain
|
sed -i -e 's/hostname=.*/hostname='"$DOMAIN"'/' /etc/ssmtp/ssmtp.conf # replace hostname with actual domain
|
||||||
sed -i -e 's/#FromLine/FromLine/' /etc/ssmtp/ssmtp.conf
|
sed -i -e 's/#FromLine/FromLine/' /etc/ssmtp/ssmtp.conf
|
||||||
printf "useSTARTTLS=YES\nAuthUser=$USER@$DOMAIN\nAuthPass=$PASS\n" >> /etc/ssmtp/ssmtp.conf
|
printf "useSTARTTLS=YES\nAuthUser=$MAILUSER\nAuthPass=$PASS\n" >> /etc/ssmtp/ssmtp.conf
|
||||||
printf "root:noreply@$DOMAIN:mail.neshweb.net:587\n" >> /etc/ssmtp/revaliases # alias 'root' sender to actual noreply sender to be used
|
printf "root:noreply@$DOMAIN:mail.neshweb.net:587\n" >> /etc/ssmtp/revaliases # alias 'root' sender to actual noreply sender to be used
|
||||||
wget "https://forgejo.neshweb.net/Neshura/disk-warn-script/raw/branch/main/disk-warn.sh" -P /root -O disk-warn.sh
|
wget "https://forgejo.neshweb.net/Neshura/disk-warn-script/raw/branch/main/disk-warn.sh" -P /root -O disk-warn.sh
|
||||||
chmod +x /root/disk-warn.sh
|
chmod +x /root/disk-warn.sh
|
||||||
|
sed -i -e 's/FROMNAME/$FROM/' /root/disk-warn.sh
|
||||||
(crontab -l 2>/dev/null; echo "0 1 * * * /root/disk-warn.sh") | crontab -
|
(crontab -l 2>/dev/null; echo "0 1 * * * /root/disk-warn.sh") | crontab -
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue