A way to hook into the "add domain" process?

Hi,

I’m not sure if this is possible or not. Is there a way I can invoke another script to run when adding a domain? Like a hook, or similar? I’m not too keen on modifying the core codes to do this, as obviously it’ll break each time we upgrade - adding more of a burden

Thanks

Andy

When assigning a template a trigger is called… with the same name as the template.sh

1 Like

Thanks. Could you explain where the template goes? So if my template set for “web” is called default2, where would I put default2.sh? (assuming I’m understanding correctly :))

Yes :slight_smile: Same folder …

Awesome. Is there any documentation on this? What I’m thinking of doing, is:

/usr/local/hestia/data/templates/web/nginx/php-fpm/default2.sh

…and then run:

perl /installer/add.cgi $domain $user

But I need to figure out what variable names we have :slight_smile:

#!/bin/bash

user="$1"
domain="$2"
ip="$3"
home="$4"
docroot="$5"

Thanks - I’ll give it a play =)

Does the .sh script need a specific chmod set? It doesn’t seem to run:

root@wbs:/usr/local/hestia/data/templates/web/nginx/php-fpm# ls -lh default.*
-rwxr-xr-x 1 root root 190 Aug 31 09:05 default.sh
-rw-r–r-- 1 root root 2.0K Aug 31 00:00 default.stpl
-rw-r–r-- 1 root root 1.7K Aug 31 00:00 default.tpl

It should have execute permissions

0755? It still doesn’t seem to want to run:

/usr/local/hestia/data/templates/web/nginx/php-fpm/default.sh

#!/bin/bash

user="$1"

domain="$2"

ip="$3"

home="$4"

docroot="$5"

# run the perl script

echo "Running perl script /installer/add.cgi $user $domain"

perl /installer/add.cgi "$user" "$domain"

Setting up a new domain, and I see this in the log files:

==> system.log <==
2023-08-31 09:37:43 v-restart-service ‘php8.1-fpm’ ‘yes’
2023-08-31 09:37:43 v-add-web-domain-backend ‘wbssystem’ ‘andytestscript.com’ ‘default’ ‘yes’
2023-08-31 09:37:43 v-restart-service ‘apache2’ ‘yes’
2023-08-31 09:37:43 v-restart-service ‘nginx’ ‘’
2023-08-31 09:37:43 v-add-web-domain ‘wbssystem’ ‘andytestscript.com’ ‘170.187.188.92’ ‘yes’

But it doesn’t seem to run the add.cgi script (or print any debug from the default.sh script). Am I doing something wrong?

Thanks!

Andy

You are using Nginx + Apache2

So the template should be:

/usr/local/hestia/data/templates/web/nginx/ located here … :slight_smile:

or

/usr/local/hestia/data/templates/web/apache2/php-fpm/default.sh

1 Like

OMG - duh! I’m so used to using just the nginx one (that’s how I used to do it, but now I do nginx + apache)

Worked like a charm =) Any ideas what the [Error 2] bit means? It seems to run it ok

==> error.log <==
2023-08-31 09:43:29 v-list-web-domain  'wbssystem' 'andytestscript.com' 'plain' [Error 3]
2023-08-31 09:43:29 v-list-web-domain  'wbssystem' 'andytestscript.com' 'plain' [Error 3]
2023-08-31 09:43:29 v-add-web-domain  'wbssystem' 'andytestscript.com' '170.187.188.92' 'yes' [Error 2]

==> system.log <==
2023-08-31 09:43:30 v-restart-service  'php8.1-fpm' 'yes'
2023-08-31 09:43:30 v-add-web-domain-backend  'wbssystem' 'andytestscript.com' 'default' 'yes'
2023-08-31 09:43:46 v-restart-service  'apache2' 'yes'
2023-08-31 09:43:46 v-restart-service  'nginx' ''
2023-08-31 09:43:46 v-add-web-domain  'wbssystem' 'andytestscript.com' '170.187.188.92' 'yes'

Have no idea why it triggers …

Thanks for looking. It all seems to run ok, so all good otherwise =)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.