The concept of a `convergent script' must be refined slightly when one expects it to interoperate and cooperate with other scripts of similar intent. A script must not only be convergent within itself, but must also behave so that the set of all scripts is convergent as a suite. To do this, each script must exhibit three crucial ingredients:
These conditions were of course inspired by the convergent processes of Cfengine[2,3,4] and our own Slink and Distr, and are exactly the behaviors that we previously attempted to ensure by scripting in Prolog instead of Cfengine or PIKT, and in Babble instead of Expect.
Of these conditions, the first two are relatively easy to ensure for a given script. These are properties of a script in isolation from others. The third property of homogeneity is a global condition on the suite of all scripts.
These seemingly abstract ideals are easy to provide in scripts.
Consider the simple task of forcing
have a particular form. A script that does this might contain1:
cp /proto/inetd.conf /etc/inetd.confThis script can be converted into a convergent one by checking that a copy is needed before making the copy:
if [ ! cmp /proto/inetd.conf \ /etc/inetd.conf ] ; then cp /proto/inetd.conf /etc/inetd.conf fiThis can be made aware by arranging for it to return the proper exit codes:
if [ ! -f /proto/inetd.conf ] ; \ exit 1 if [ ! cmp /proto/inetd.conf \ /etc/inetd.conf ] ; then cp /proto/inetd.conf /etc/inetd.conf fi exit 0To make it homogeneous with other scripts, however, every script that modifies
/etc/inetd.confmust modify it into this exact form.