aboutsummaryrefslogtreecommitdiffstats
path: root/roles/web/files/acme/deploy.sh
blob: 7464d021107bfc66630c88e803b73df3b3deb77b (plain)
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
#!/bin/sh -e
#
# Deploy the renewed certificate(s) to services.
#
# Aaron LI
#

reload() {
    local srv="$1"
    local rv=0
    if service ${srv} status >/dev/null 2>&1; then
        echo "Reloading service ${srv} ..."
        service ${srv} reload
        echo "ok"
    else
        echo "WARNING: service ${srv} is not running" >&2
        rv=1
    fi
    return ${rv}
}


restart() {
    local srv="$1"
    local rv=0
    if service ${srv} status >/dev/null 2>&1; then
        echo "Restarting service ${srv} ..."
        service ${srv} restart
        echo "ok"
    else
        echo "WARNING: service ${srv} is not running" >&2
        rv=1
    fi
    return ${rv}
}


echo "============================================================="
dir="${0%/*}"
rv=0
for f in ${dir}/deploy.d/*; do
    if [ -f "${f}" ]; then
        echo "Deploying [${f##*/}] ..."
        . "${f}" || rv=$?
    fi
done
exit ${rv}