#!bin/bash
#Assuming the NPM conf is at $baselocation
#This script can be placed at /etc/opt/scripts/
umask 077
baselocation="/etc/opt/docker_conf/nginxproxymanager-stack/data/letsencrypt/live/"

latestnpmfolder=$(ls -t "$baselocation"|head -n 1)
certlocation=$baselocation$latestnpmfolder/
pushd $certlocation
cp -L -rf fullchain.pem /etc/ssl/certs/portainer/
cp -L -rf privkey.pem /etc/ssl/certs/portainer/