hi all,
 
i'm trying to write an script who automatically creates new virtual domains in vpopmail
 
my script uses the vadddomain binarie from vpopmail.
 
the syntax for vadddomain is : vadddomain [domain name] [postmaster passwd]
so i create i text file with :
 
...
...
test.com test
...
....
 
the problem is that vadddomain doesn't treat my file per line ....
well, i'm a script newbie, so i let you see what i'm doing :)) script is next :
 
----------------------------------------------------------------------------------------------------------------------------------
PATH="$PATH:/var/spool/popmail/bin"
 
VDOMAINSFILE="/home/tech/vdomain.txt"
VDOMAINSOLDFILE="/home/tech/vdomain.txt.old"
NEWDOMAINSFILE="/home/tech/new_vdomains.list"  
NEWVDOMAINS="/var/tmp/new_vdomains.tmp"
 
if test -s $VDOMAINSFILE
then
if [ $VDOMAINSFILE -nt $VDOMAINSOLDFILE ]; then
diff -u $VDOMAINSOLDFILE $VDOMAINSFILE | grep -v "^+++" | grep -v "^+;" | grep "^+" | sed -e s/^+//g >> $NEWVDOMAINS
fi
#
awk 'BEGIN { FS=":"} {print $1 " " "test"}' $NEWVDOMAINS > $NEWDOMAINSFILE
 

   
vadddomain && cat $NEWDOMAINSFILE
  
rm $NEWVDOMAINS $NEWDOMAINSFILE
------------------------------------------------------------------------------------------------------------------------------------------------------
 
and here the output file :
-------------------------------------------------------------------------------------------------------------------------------------------------------
# less new_vdomains.list
test.org testorg
test.net testnet
 
---------------------------------------------------------------------------------------------------------------------------------------------------------
 
thx in advance
 
 

Reply via email to