Hi Jamesk,
You need to put your public hostname, without any protocols (so donāt put http or https in there).
If youāre using the QNAP cloud DDNS service, it will be myhostname.myqnapcloud.com, where āmyhostnameā is your account name.
Itās important that this matches the hostname you use to access your plex server exactly, otherwise the browser will complain that it is invalid.
In case you find it useful, hereās my version of the script. I added comments as a reminder for when I modify it. As you can see, itās pretty much identical to the script that OP posted, but it explains some additional things you need to know.
# IMPORTANT!!! Windows line endings will prevent bash from working!!!!
# If you ever modify this script, you must run dos2unix and pass this file to it
# You must also run chmod +x to allow this script to be executed
BASEPATH=/mnt/HDA_ROOT/.config/QcloudSSLCertificate/cert
CERT_PASS=redacted
HOST_NAME=myhostname.myqnapcloud.com
echo exporting cert...
/usr/bin/openssl pkcs12 -export -in ${BASEPATH}/cert -inkey ${BASEPATH}/key -out ${BASEPATH}/cert.p12 -name ${HOST_NAME} -CAfile ${BASEPATH}/chain -caname root -password pass:${CERT_PASS}
echo restarting plex...
/etc/init.d/plex.sh stop
/etc/init.d/plex.sh start
You must also run chmod +x to allow this script to be executed, otherwise it wonāt work. You need to do this every time you modify the file.
chmod +x /share/CACHEDEV1_DATA/homes/admin/scripts/plex_cert.sh
Windows users also need to remove carriage returns from the file, I do this by using the dos2unix command.
dos2unix /share/CACHEDEV1_DATA/homes/admin/scripts/plex_cert.sh
Remember, if you do this, youāll need to use chmod +x again, because it modifies the file.
Hereās my crontab entry, to make my script automatically run at 03:00 every day. The >/dev/null 2>&1 ignores output from standard error and standard out.
0 3 * * * /share/CACHEDEV1_DATA/homes/admin/scripts/plex_cert.sh >/dev/null 2>&1