#!/bin/sh
if [ "$myval" = "yes" ]; then
echo "CustomApache code" >> /usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd
echo "action=rewrite&value=httpd&user=$username" >> /usr/local/directadmin/data/task.queue
fi
exit 0;
这会将“CustomApache代码”插入到| CUSTOM |中 令牌在virtual_host2 * .conf模板文件中。
这些模板通过使用if-then-else语句和变量提供了更多的灵活性。 例如,如果编辑全局模板以获得一些代码......但您只希望某些用户或域可用的代码,则可以使用if-then-else和变量。 对于这个例子,如果设置了变量MYVAL = yes,那么我们将代码插入到httpd.conf中,例如在virtual_host2 * .conf文件中,在| CUSTOM | 令牌:
|*if MYVAL="yes"|
CustomApache code
|*endif|
echo "CustomApache code" >> /usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd
用这个来代替echo "|?MYVAL=yes|" >> /usr/local/directadmin/data/users/$username/domains/$domain.cust_httpd








