View Single Post
  #7   (View Single Post)  
Old 7th June 2008
splooge splooge is offline
New User
 
Join Date: May 2008
Posts: 5
Default

Thanks Terry! Using the ticks worked out really well! What I forgot to mention was that I am trying to pass a variable ("$1") that doesn't seem to work.

Code:
omni# cat terry.sh
ssh ns2 'echo "zone \"$1\" {
        type slave;
        file \"sec/db.$1\";
        masters { 72.26.x.x; };
};
" >> test'
omni# ./terry.sh test.com
Ends up looking like so:
Code:
zone "" {
        type slave;
        file "sec/db.";
        masters { 72.26.x.x; };
};
HOWEVER! I extrapolated and expanded your idea with the ticks (without really knowing what I was doing!) and "unticked" the variable:
Code:
omni# cat terry.sh
ssh ns2 'echo "zone \"'$1'\" {
        type slave;
        file \"sec/db.'$1'\";
        masters { 72.26.x.x; };
};
" >> test'
And it works flawlessly!!!
Code:
omni# ./terry.sh test.com
Resulted in:
Code:
zone "test.com" {
        type slave;
        file "sec/db.test.com";
        masters { 72.26.x.x; };
};
Thank you! I can't begin to say how much I appreciate all your guys' help. I can now move on with my life. =)

Here are the results:
Code:
omni# ./newdomain.sh test.com 1.1.1.1
Creating initial zone file ...
Changing ownership on db.test.com ...
Updating named.conf ...
Reloading named ...
server reload successful
Populating named.conf on ns2 ...
Reloading named on ns2 ...
server reload successful
Code:
omni# host www.test.com ns1
www.test.com is an alias for test.com.
test.com has address 1.1.1.1

omni# host www.test.com ns2
www.test.com is an alias for test.com.
test.com has address 1.1.1.1
Nice, clean, and all in one script!

splooge
Reply With Quote