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
eris
August 31, 2023, 8:13am
2
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 :))
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
eris
August 31, 2023, 8:57am
6
#!/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
eris
August 31, 2023, 9:09am
9
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
eris
August 31, 2023, 9:41am
11
You are using Nginx + Apache2
So the template should be:
/usr/local/hestia/data/templates/web/nginx/ located here …
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'
eris
August 31, 2023, 9:52am
13
Have no idea why it triggers …
Thanks for looking. It all seems to run ok, so all good otherwise =)
system
Closed
September 30, 2023, 10:48am
15
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.