DNS Magic: cronjobs
*******************

The following list describes some of the standard modules provided for
automating DNS updates. 
Not all are specific to `DNS Magic`_. 
Note that we do not install many of these by default as every site has
their own thoughts on what they do or do not want to automate.

The ``.list`` files mentioned refer to the `configs(8)`_ list that
installs the file. 
If no ``.list`` is mentioned the file is not installed automagically and
needs to be manually created (or a local ``.list`` file created) if
desired. 
See `configs(8)`_ for details.

`S00os.sh`_ cronjob.list: 

	Standard OS setup. cronjob.list, is included by
	dnsmagic-cronjob.list 

S01site.sh cronjob.list: 

	Just sets a suitable PATH

`S02redirect.sh`_ cronjob.list: 

	Sets up environment such that all output can be collected and
	e-mailed to admin (see mailrep.sh)  

S05lsetup.sh dnsmagic-cronjob.list: 

	This is *not* included with DNSMagic but will be installed if
	it can be found under /`configs`_
	(eg. ``/configs/local/usr/local/share/dns/cron.d/lsetup.sh``)
	and is a good place to set ``WORK_DIR`` to where you want DNS
	cron jobs to play. 

	It goes without saying that ``WORK_DIR`` must exist and must
	contain a checked out copy of the DNS repository. 

`S06interlock.sh`_ dnsmagic-cronjob.list: 

	Provides interlocking between cron jobs. 

S10setup.sh 

	cd's to ``WORK_DIR``, ensures there is a private temp
	directory and updates PATH.

S15scm_update dnsmagic-cronjob.list: 

	Makes sure that WORK_DIR has an up to date copy of the DNS
	repository. 

`S20atjobs`_

	Used in the hourly cronjob to handle one off scheduled
	changes. 
	Basically it processes any files named for the current year
	month day and hour and renames them such that they will not be
	processed again even if atjobs is run multiple times in the
	same hour.
	The processing is handled in the same way as `rc.sh(8)`_.  

S80scm_commit dnsmagic-updrevs.list: 

	Commits changes made so far. 
	This is necessary for ``updrevs`` to do its job accurately. 
	``dnsmagic-updrevs.list`` includes ``dnsmagic-cronjob.list`` 

`S82dnsmagic`_ 

	This is the job that updates the live DNS directory and
	reloads or bounces the live named if needed. 
	It is performed as part of ``S85updrevs``, so only one of
	these jobs need be run. 

	While ``/etc/rc_d/dnsmagic`` is always installed, the link to
	``S82dnsmagic`` is not and must be manually made by sites that
	actually want this degree of automation.  

`S85updrevs`_ dnsmagic-updrevs.list: 

	This job is the main event.
	It updates the live tree with the just committed changes
	(unless ``.nomagic`` is present in ``WORK_DIR``), and bounces
	named(8) if needed.  

	It then runs `getdb`_ to get named(8) to dump its cache and
	then format it using `getdata`_. 

	Finally it runs `updrev`_ to generate any missing PTR records
	for networks that the nameserver is authoritative for. 

S88scm_diff dnsmagic-cronjob.list:

	Records the changes made by ``updrevs`` 

S90scm_commit dnsmagic-cronjob.list:

	Commits any changes (eg. made by ``updrevs``) 

S92dnsmagic dnsmagic-updrevs.list: 

	This is the job that updates the live DNS directory and
	reloads or bounces the live named if needed. 

S99mailrep.sh cronjob.list: 

	E-mails the report to admin, a copy will also be kept in
	``WORK_DIR`` called ``hourly.rep`` for the hourly cron job.

--------

The lastest version of this page can be found at:
 http://www.crufty.net/help/dns/cron.htm

:Author: sjg@crufty.net */\* imagine something very witty here \*/*
:Revision: $Id: cron.txt,v 1.1 2016/04/10 19:30:12 sjg Exp $
:Copyright: `1997-2016 Simon J. Gerraty`_ 

.. _`1997-2016 Simon J. Gerraty`: http://www.crufty.net/misc/copyrght.html

.. _`DNS Magic`: DNSMagic.htm
.. _`configs(8)`: /cgi-bin/rtfm?topic=configs
.. _S00os.sh: /cgi-bin/rtfm?topic=os.sh
.. _S02redirect.sh: /cgi-bin/rtfm?topic=redirect.sh
.. _S06interlock.sh: /cgi-bin/rtfm?topic=interlock.sh
.. _S20atjobs: /cgi-bin/rtfm?topic=atjobs
.. _`rc.sh(8)`: /cgi-bin/rtfm?topic=rc.sh
.. _S82dnsmagic: /cgi-bin/rtfm?topic=dnsmagic
.. _S85updrevs: /cgi-bin/rtfm?topic=updrevs
.. _getdb: /cgi-bin/rtfm?topic=getdb
.. _getdata: /cgi-bin/rtfm?topic=getdata.pl
.. _updrev: /cgi-bin/rtfm?topic=updrev.pl
.. _configs: http://www.crufty.net/FreeWare/configs.html
