forked from ssddanbrown/sslcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
email-example.sh
executable file
·30 lines (23 loc) · 1.27 KB
/
email-example.sh
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
#!/bin/bash
# This example script will check the ssl expiry status for the specified
# domains and send the results via email.
# This script requires the 'mail' command and php to be set up.
# The `sslcheck` script needs to be in the same folder as this script..
## CONFIG
#############
# ./sslcheck www.gorro.com.ar tienda.gorro.com.ar www.tresdoce.com.ar www.estudiofluk.com.ar apicedes.tresdoce.com.ar www.estudiohamaca.com.ar www.adipol.com.ar jenkins.tresdoce.com.ar static-pre.tresdoce.com.ar static.tresdoce.com.ar
# Set the domains you want to check, Space separated.
DOMAINS="www.gorro.com.ar tienda.gorro.com.ar www.tresdoce.com.ar www.estudiofluk.com.ar apicedes.tresdoce.com.ar www.estudiohamaca.com.ar www.adipol.com.ar jenkins.tresdoce.com.ar static-pre.tresdoce.com.ar static.tresdoce.com.ar"
# Set the email address you want to send the results to
EMAIL="[email protected]"
## SCRIPT
#############
# Get current dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Run sslcheck command and store output
OUTPUT=`php $DIR/sslcheck $DOMAINS`
# Get current date
NOW=$(date +"%Y-%m-%d")
# Send output via email, Replacing ASCII escape codes
echo "$OUTPUT"| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" \
| mail -s "Your Weekly SSL Report for $NOW" $EMAIL