forked from ISTI-ansible-roles/ansible-roles
36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
LE_CERTS_DIR="{{ letsencrypt_acme_certs_dir }}"
|
|
LE_LOG_DIR=/var/log/letsencrypt
|
|
LE_LOG_FILE=$LE_LOG_DIR/onlyoffice.log
|
|
onlyoffice_certdir=/var/www/onlyoffice/Data/certs
|
|
|
|
DATE=$( date )
|
|
|
|
[ ! -d "$onlyoffice_certdir" ] && mkdir -p "$onlyoffice_certdir"
|
|
[ ! -d "$LE_LOG_DIR" ] && mkdir "$LE_LOG_DIR"
|
|
echo "$DATE" >> "$LE_LOG_DIR/postgresql.log"
|
|
|
|
if [ -f /etc/default/letsencrypt ] ; then
|
|
. /etc/default/letsencrypt
|
|
else
|
|
echo "No letsencrypt default file" >> $LE_LOG_FILE
|
|
fi
|
|
|
|
echo "Copy the key file" >> $LE_LOG_FILE
|
|
cp "${LE_CERTS_DIR}/privkey" $onlyoffice_certdir/onlyoffice.key
|
|
chmod 400 $onlyoffice_certdir/onlyoffice.key
|
|
chown root:root $onlyoffice_certdir/onlyoffice.key
|
|
cp "${LE_CERTS_DIR}/cert" $onlyoffice_certdir/onlyoffice.crt
|
|
chmod 400 $onlyoffice_certdir/onlyoffice.crt
|
|
chown root:root $onlyoffice_certdir/onlyoffice.crt
|
|
|
|
echo "Restart the onlyoffice service" >> $LE_LOG_FILE
|
|
if [ -x /bin/systemctl ] ; then
|
|
systemctl reload nginx >> $LE_LOG_FILE 2>&1
|
|
else
|
|
service nginx reload >> $LE_LOG_FILE 2>&1
|
|
fi
|
|
echo "Done." >> $LE_LOG_FILE
|
|
|
|
exit 0 |