help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Matching troubles.


From: Danny Holth
Subject: Matching troubles.
Date: Mon, 11 Dec 2000 20:07:29 -0500
User-agent: Mozilla/5.0 (X11; U; Linux 2.4.0-test1 i686; en-US; m18) Gecko/20001018

Hi. I wrote the attached script to keep an /etc/fstab maintained. It works great except that it rewrites the file each time it is run. Can you help me figure out what I did wrong?

Thanks.

- Daniel Holth
#!/usr/sbin/cfengine -v -f
# A script for setting up the NFS directories (home2,3,4) and /etc/fstab...
# [if you are editing this in vi, try `:set nowrap'.]
# Daniel Holth
# Last modified: 6 Apr. 2000

control:
        # Greater wsize, rsize is said to improve performance greatly...
        nfsOptions = ( "bg,soft,rsize=8192,wsize=8192" )

        home2     = ( "negroponte:/home2        /home2                  nfs     
$(nfsOptions)   0 0" )
        home3     = ( "negroponte:/home3        /home3                  nfs     
$(nfsOptions)   0 0" )
        home4     = ( "negroponte:/home4        /home4                  nfs     
$(nfsOptions)   0 0" )
        home5     = ( "negroponte:/home5        /home5                  nfs     
$(nfsOptions)   0 0" )
        scratch   =     ( "negroponte:/scratch  /scratch                nfs     
$(nfsOptions)   0 0" )
        localLinux =    ( "negroponte:/usr/local/linux /usr/local               
nfs     $(nfsOptions)   0 0" )
    milliFTP =  ( "milliways:/home/ftp  /mnt/milliways          nfs     
$(nfsOptions)   0 0" )
        milliMrr =      ( "milliways:/home/ftp/mirror   /mnt/milliways/mirror   
        nfs     $(nfsOptions)   0 0" )

editfiles:
        mathcs::
                { /etc/fstab

                        BeginGroupIfNoMatch "$(home2)" 
                                DeleteLinesMatching "negroponte:/home[2345].*"
                                DeleteLinesMatching "negroponte:/scratch.*"
                                DeleteLinesMatching 
"negroponte:/usr/local/linux.*"
                                DeleteLinesMatching "milliways:/home/ftp.*"
                        EndGroup

                        SetLine "$(home2)"
                        AppendIfNoLineMatching "negroponte:/home2.*"

                        SetLine "$(home3)"
                        AppendIfNoLineMatching "negroponte:/home3.*"

                        SetLine "$(home4)"
                        AppendIfNoLineMatching "negroponte:/home4.*"

                        SetLine "$(home5)"
                        AppendIfNoLineMatching "negroponte:/home5.*"

                        SetLine "$(scratch)"
                        AppendIfNoLineMatching "negroponte:/scratch.*"

                        SetLine "$(localLinux)"
                        AppendIfNoLineMatching "negroponte:/usr/local/linux.*"  

                        SetLine "$(milliFTP)"
                        AppendIfNoLineMatching "milliways:/home/ftp     .*"

                        SetLine "$(milliMrr)"
                        AppendIfNoLineMatching "milliways:/home/ftp/mirror      
.*"
                        
                        DefineClasses   "fstabDirty"
                }

# Add the necessary directories...
directories:
                /home2   mode=644       owner=root group=root
                /home3   mode=644       owner=root group=root   
                /home4   mode=644       owner=root group=root
                /home5   mode=644       owner=root group=root
                /scratch mode=666       owner=root group=root
                /mnt/milliways  mode=644 owner=root group=root

shellcommands:
        mathcs::
                "$(cfhome)/util/millifix"
        fstabDirty::
                "/bin/mount -a"
                        timeout=120


reply via email to

[Prev in Thread] Current Thread [Next in Thread]