Custom scripts on admin restore, order of things

kristian

Verified User
Joined
Nov 4, 2005
Messages
491
Location
Norway
Hi!

I have a custom script domain_create_post/httpd_custom_config.sh that adds (appends) some extra config to new domains. I was under the impression that this script (and others like it) only ran when a new domain was created. I have however now discovered that it also runs when an admin backup is restored. While it obviously also creates a domain, I didn't really expect it to be treated as a new domain as such.

Let's for simplicity say that the script is as follows:
Code:
# cat /usr/local/directadmin/scripts/custom/domain_create_post/httpd_custom_config.sh
#!/bin/bash

echo "# Testing" >> "/usr/local/directadmin/data/users/${username}/domains/${domain}.cust_httpd.4"

There are at least two scenarios:

1) The backup I'm restoring does currently not have an existing .cust_httpd.4 file. This domain will now get the custom config as provided by the script.

2) The backup I'm restoring does have an existing .cust_httpd.4 file. The custom script will still run, and add the # Testing line, but this seems to happen before the backup is extracted, so seconds later it gets overwritten by whatever is in the backup being restored.

If the order in scenario 2) was reversed, the domain would get an ever-growing list of "Testing" comments in their .cust_httpd.4 file due to the way it's written (yes, it could be written in a more clever way).

While these are very specific scenarios in a specific script, I guess my question is more general: Is the order of "things" documented anywhere? And by "things" I mean the restore process, the custom scripts, and anything else involved in this process. Will the same happen with email_create_post scripts, or dns_create_post for example? Can I rely on the current order to always stay the same?
 
Last edited:
it not have any document, Just use programming skill and imagine when you doing in backup or restore processing, order first and last should be backup_pre and backup_post. right ? Because you done in backup or restore job.
 
Back
Top