not recognized $domain

NovaWebSE

Verified User
Joined
Jan 23, 2014
Messages
28
Goodmorning everyone,
I'm building a custom script.
I do not understand why the ( $domain ) command is not recognized.
Basic example:
cp testfile.txt /etc/virtual/$domain/
Does not work
How can I solve?
thank you all
 

smtalk

Administrator
Staff member
Joined
Aug 22, 2006
Messages
8,327
Location
LT, EU
What's the name of the script you're trying to execute? (full path to it would be great)
 

NovaWebSE

Verified User
Joined
Jan 23, 2014
Messages
28
He does not accept the command >>> $domain

echo "high_score=15" >> /etc/virtual/$domain/filter.conf
echo "high_score_block=yes" >> /etc/virtual/$domain/filter.conf
echo "where=userspamfolder" >> /etc/virtual/$domain/filter.conf
echo "rewrite_header subject *****SPAM*****" >> /home/$username/.spamassassin/user_prefs
 

kristian

Verified User
Joined
Nov 4, 2005
Messages
100
Location
Norway
You're not answering the question of what the name and full path of your script is. Linking to an article doesn't tell us anything, because you may or may not have followed it correctly.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,853
Location
GMT +7.00
Hello,

Variables in the script /usr/local/directadmin/scripts/custom/domain_create_post.sh mentioned in the article can be "recognized" only when the script is executed by Directadmin.

To make it work when executing the script manually in a shell you need first define the missing variables. So you need to run it per user/domain or use a loop. You can find an example here https://help.directadmin.com/item.php?id=319 Start reading after words "If you wish to apply this to existing domains, you can create the script".
 

NovaWebSE

Verified User
Joined
Jan 23, 2014
Messages
28
Thanks for the answers,
I suppose we did not understand each other.
If I do the single script:

echo "high_score = 15" >> /etc/virtual/mydomain.com/filter.conf
ok it works

If I do this for all domains on the server:

echo "high_score = 15" >> /etc/virtual/$domain/filter.conf
does not work

I hope I was clear this way.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,853
Location
GMT +7.00
Call the script this way:


Code:
domain="[B]mydomain.com[/B]"; echo "high_score = 15" >> /etc/virtual/$domain/filter.conf

replace with your domain, and check my previous post if you need to run it for all domains.
 
Top