# Refresher on FRED Remember the prerequisites for creating objects in the Fred DB (from https://fred.nic.cz/page/2906/installation-ubuntu/ and https://fred.nic.cz/page/699/fred-client-how-to/ 1. Make sure you have an existing contact, or create one 2. Make sure you have an NS-set, or create one, and associate it to the contact 3. Once the above are fulfilled, you can create a domain, referencing the contact and NS-set From the Ubuntu installation above, you remember running this command near the end: `genzone_client` ... if you remember, this automatically generated (created and wrote the contents) all the zones to disk. Let's create a place where we can export our zones: ~~~ cd mkdir zones cd zones pwd ~~~ The 4 commands above make sure you that: - you are in your home directory (`cd`) - a directory "zones" exist (`mkdir zones`) - you change the current working directory to "zones" (`cd zones`) - you verify that you are indeed placed inside this directory (`pwd`) Once you've done this, let's run the `genzone_client`: ~~~ genzone_client ~~~ Then ~~~ ls -l ~~~ ... you should see at list one file, for the zone of the domain for the TLD that was created when you installed FRED. For example, you may see: ~~~ -rw-rw-r-- 1 sysadm sysadm 719 Jun 1 07:19 db.dk ~~~ # Automate zone generation Now, we would like to have the above "zone generation" take place automatically, so we don't need to remember to do it manually every time we make changes in the zone. To do this, we're going to use `cron`. cron is an automated scheduling utility that will run jobs when you tell it to. Cron takes a very simple format, called a `crontab`, in this form: ~~~ Minute Hour Day-of-Month Month Day-of-Week Command [params] ~~~ For example, if we wanted to say "hello" at 5 minute past the hour on every hour, Monday to Friday, we would write: ~~~ 5 * * * * 1-5 echo "hello" ~~~ This reads as: At 5 minute past the hour, every hour, every day, every month, Mon-Fri, say hello. Let's create a `crontab` for the `genzone_client`, that will automate zone generation! To do this, run the `crontab -e` command: ~~~ crontab -e ~~~ You will probably be asked which editor you want to use the first time: ~~~ no crontab for sysadm - using an empty one Select an editor. To change later, run 'select-editor'. 1. /usr/bin/vim.basic 2. /usr/bin/vim.tiny Choose 1-2 []: ~~~ Pick 1 or 2 -- and you will be brought into a `vi` editor, with some text. Go to the bottom, and add the following line: ~~~ */5 * * * * cd /home/sysadm/zones && genzone_client ~~~ (Copy-pasting the above line is probably the easiest!) The above reads as: Every 5 minutes of every hour, every day, every month, all weekdays, run the commands "`cd /home/sysadm/zones && genzone_client`" Once you've added the line, save the file and exit. You should see: ~~~ crontab: installing new crontab ~~~ Now instead of waiting 5 minutes, let's start configure BIND!