Is this on an ISPConfig host? I have thought that happens automatically. If not, I do not know how it it done if using acme.sh, but certbot has pre, post hooks. https://www.howtoforge.com/communit...ts-of-errors-in-standalone.79363/#post-379833
It does, unless you didn't use the built in function, in which case you can use the steps from the link I posted.