-
Notifications
You must be signed in to change notification settings - Fork 1
/
certbot-apache.sh
executable file
·61 lines (53 loc) · 1.05 KB
/
certbot-apache.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
function new {
sudo certbot --apache
if [ $? -eq 0 ]
then
echo "Obtained Certificate Successfully :)"
else
echo "Error while attempting to Obtain a new Certificate :("
fi
}
function renew {
sudo certbot renew --apache
if [ $? -eq 0 ]
then
echo "Certificate Renewal Successful:)"
else
echo "Error while attempting renewal :("
fi
}
function test {
sudo certbot renew --apache --dry-run && sudo service apache2 restart
if [ $? -eq 0 ]
then
echo "Dry Run Successful :)"
else
echo "Error while running dry run :("
fi
}
OPTIONS="Test New Renew Quit"
select opt in $OPTIONS; do
if [ "$opt" = "Test" ]; then
echo Running dry run...
test
echo Dry Run complete.
exit
elif [ "$opt" = "Renew" ]; then
echo Renewing...
renew
echo Renewal complete.
exit
elif [ "$opt" = "New" ]; then
echo Obtaining Certificate...
new
echo Certificate Obtaining complete.
exit
elif [ "$opt" = "Quit" ]; then
echo Goodbye.
exit
else
clear
echo Bad option
fi
done