21 lines
429 B
Plaintext
21 lines
429 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
PATH="/bin:/usr/bin:/sbin:/usr/sbin"
|
||
|
CERT_DIR="{{ certsync_dir }}"
|
||
|
|
||
|
if [ ! -d $CERT_DIR ]; then
|
||
|
mkdir -p $CERT_DIR
|
||
|
chown root.root $CERT_DIR
|
||
|
chmod 750 $CERT_DIR
|
||
|
fi
|
||
|
|
||
|
sftp -q -i {{ certsync_key }} certsync@{{ certsync_host }}:* "$CERT_DIR/" > /dev/null 2>&1
|
||
|
if [ $? -ne 0 ]; then
|
||
|
echo "Error getting certificates"
|
||
|
exit 1
|
||
|
fi
|
||
|
chown root.root $CERT_DIR/*
|
||
|
chmod 440 $CERT_DIR/*
|
||
|
|
||
|
service nginx reload > /dev/null
|