Setup: Debian 12 on an RPi4 hosting a couple of low traffic websites thru a publically visible static IP.
I use Lets Encrypt and .acme.sh running as root from the /root directory to regularly regenerate my SSL certificates for my websites.
I also have /usr/bin/apachectl symlinked into the /root directory so that .acme.sh can set the certificates for apache2 to use, and I have all of this set up in a bash script.
When I run the bash script in the foreground it all runs as expected and the certificates are regenerated and apachectl sets them in place.
The problem comes when I want to run this bash script in a crontab; the certificates are regenerated without problem but the crontab complains that it can't find apachectl. Consequently the certificates are not set into place.
My assumption is that crontab doesn't know about symlinks.
Should I be hardlinking /usr/bin/apachectl into /root, and are there any adverse consequences as a result? I don't need to make this hard
link permanent but could include it in the bash script and delete it at the end of the script.
The bash script:
Code:
raspi-dmz:~# cat dmz.d/ssl.sh
S=raspi-dmz
D=acme-domain
H=EXAMPLE.COM
P=mosquitto_pub
Q=2
T=ssl
I=upgrade
M=''
~/.acme.sh/acme.sh --upgrade 2>~/_$D\.err
E=$?
if [ $E -ne '0' ]
then M=FAILED
fi
echo ''
$P -h $H -t $T/$I -m "$E '$I' $M" -q $Q
for I in $(cat ~/$D); do
M=''
~/.acme.sh/acme.sh --domain $I --renew 2>>~/_$D\.err
E=$?
case $E in
'2')
M=SKIPPED
;;
'1')
M=FAILED
;;
'0')
M=INSTALLED
;;
*)
M=EXIT_UNK
;;
esac
echo ''
$P -h $H -t $T/$D -m "$E '$I' $M" -q $Q
done