Hi, I am writing some automation that uses the API. Essentially, it creates a website, ftp user, db user and database. This is all working, and was pretty straightforward to implement. What I am trying to do next is take some pre made site and copy the webfolder to the new site (like a template). This means I need to run something similar to this command "cp -R /var/www/clients/client1/web5/web /var/www/clients/clientX/webY/", followed by "chown" with the correct permissions. I'd like to use the existing structure and functions of the API. What is the recommended way to achieve this using the API? Thanks
You must create a server-side plugin for this. Is it always the same site that gets copied every time, or are these different sites?
Perhaps this also works with the Apache module mod_vhost_alias? https://httpd.apache.org/docs/current/en/mod/mod_vhost_alias.html
This module makes no sense on an ISPConfig system. First, you would not be able to use ISPConfig on that server, and then mod_bhost_alias is not able to run multiple sites securely with separate user permissions. This module is something of the past e.g. to mass host websites with static HTML.
There are multiple sites that can be copied. I noticed in the current API there is code which executes shell, but I couldn't figure out how to use it. Perhaps I can write an additional function in the API files? Thanks
There is no such function in the API to run exec commands via API. This will not help you as the API runs as unprivileged user, so it will not be able to copy files into websites. If you want to implement a new API function, you will have to implement a function in the API to store a value in the database and then also code a server side plugin which then executes the commands to copy the site.