[sdnog] shell Script for DNS
Manhal Mohammed
manhal_muhamed at hotmail.com
Mon Jan 11 12:45:33 SAST 2016
Hi Samir
can you share with us your script ?i don't think the whole script will be useful for you bcz i'm writing it section by section then adding it to the main script now i'm running this section as a small script just for creating new domain : #####################################################################CREATE NEW DOMAIN: #!/bin/bash echo ENTER YOUR DOMAIN : read new_domain cp ext.example.sd.zone ext.$new_domain.sd.zone #create new domain sed -i -e 's/20[0-9][0-9]\{6\}/2016011100/g' ext.$new_domain.sd.zone #reset the serial num for the new domain #####################################################################
you can execute it if have a testing DNS vms or something :)
also you can check the following:- bash version can't tell you but yes it is not effecting the script
- if you are in the correct path : yes i'm in the correct path
- typos and wrong spelling in the script : mmm i dont think there are typos and wrong spelling unless it is in the way how to write the variable which is my main problem - run your script in debug mode (bash -x your_script): this is the debug result : bash -x newdomain.sh+ echo enter your domain $'\r'enter your domain+ read $'new_domain\r'mnhl': not a valid identifierd: `new_domain+ cp ext.example.sd.zone $'ext..sd\r'
Hi manhal
can you share with us your script ?
also you can check the follwoing
- bash version
- if you are in the correct path
- typos and wrong spelling in the script
- run your script in debug mode (bash -x your_script).
Samir
From: "Manhal Mohammed" <manhal_muhamed at hotmail.com>
To: sdnog at sdnog.sd
Sent: Monday, January 11, 2016 10:45:21 AM
Subject: [sdnog] shell Script for DNS
helloooo Sdnoggers ^_^
i have a question on shell scripting :) i'm trying to make a shell script to change IPs , adding new domains on DNS and many other operations to make it easier for me :D
on "creating new domain" section of this script :
i have a zone file "ext.example.sd"witch i want to copy to the new domain which is a "variable" so : this is my idea of how this simple section of my script will be :
##########
echo ENTER YOUR DOMAIN : read new_domain cp ext.example.sd ext.$new_domain.sd # this is not working :D sed -i -e 's/20[0-9][0-9]\{6\}/2016011100/g' ext.$new_domain.sd #to reset the serial num
###########
reconsider that the copied new zone have to be renamed as : "ext.new_domain.sd.zone " new_domain is a variable
thanks in advance :)
Mnhl ^_^
_______________________________________________
sdnog mailing list
sdnog at sdnog.sd
http://lists.sdnog.sd/mailman/listinfo/sdnog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sdnog.sd/pipermail/sdnog/attachments/20160111/e410d73b/attachment.html>
More information about the sdnog
mailing list