I’d like to know if there is a way to determine programmatically what the web directory is for a domain. I know that this information is available via the panel, but I was wondering if it can be determined in a shell script.
Correct me if I’m wrong, but isn’t the web directory usually just /home//?
$pwd will give the current working directory in shell.
Maximum Cash Discount on any plan with MAXCASH
No, you’re right, but the key word in your question is “usually”. By convention, when a user creates a domain, she will specify that its web directory as /home//. But she’s free to use any other path in her home directory for a domain even if it’s unrelated. For example, the web directory for “foo.example.org” could be /home//bar/baz/qux.
I’m curious to know if there is a way for a shell script look up the web directory for a domain. Using the example above, if the user were to run the script and give “foo.example.org” as an argument, could the script somehow determine the web directory is /home//bar/baz/qux?
No such function is provided. You will have to make your own way for a shell script to look up the web directory for a domain.