The script was rsync old to overwrite new pem files. now it's fix use acme.sh generated pem overwrites to other folders.

Jiang Sheng 2018-06-20 13:38:50 +08:00
parent d67a2d8890
commit 114035e563
1 changed files with 4 additions and 8 deletions

@ -79,23 +79,19 @@ In DSM control panel, open the 'Task Scheduler' and create a new scheduled task
* Task setting: User-defined-script:
```
# Note: The $CERT_FOLDER must be hardcoded here since the running environment is unknown. Don't blindly copy&paste
# change this sample directory name "AsDFgH" to the name of your Let's Encrypt cert directory
CERTDIR="AsDFgH"
# do not change anything beyond this line!
CERTROOTDIR="/usr/syno/etc/certificate"
#CERTROOTDIR="/usr/syno/etc/certificate/system/default/"
PACKAGECERTROOTDIR="/usr/local/etc/certificate"
FULLCERTDIR="$CERTROOTDIR/_archive/$CERTDIR"
FULLCERTDIR="$CERTROOTDIR/system/default"
# find all subdirectories containing cert.pem files
PEMFILES=$(find $CERTROOTDIR -name cert.pem)
if [ ! -z "$PEMFILES" ]; then
for DIR in $PEMFILES; do
# replace all certificates, but not the ones in the _archive folder
if [[ $DIR != *"/_archive/"* ]]; then
# replace all certificates, but not the ones in the default folder
if [[ $DIR != *"/default/"* ]]; then
rsync -avh "$FULLCERTDIR/" "$(dirname $DIR)/"
fi
done