Next: , Previous: Sharing files, Up: Writing scripts for cfengine



2.3 Root script for emergency disk clearing

A straightforward script could be used to clear space in cases where the disk hits the overflow level. This script tidies the whole system, not just the affected disk.

     #!/local/gnu/bin/cfengine -f
     #
     # Emergency tidyup!
     #
     # (Users read their cfengine.rm files to see what got deleted!)
     #
     
     control:
     
     site = ( mysite )
     
     mountpattern = ( $(site)/$(host) )
     homepattern   = ( u? )
     
     actionsequence =
        (
        tidy
        )
     
     
     tidy:
     
           home            pattern=core   R=inf   age=0
           home            pattern=*~     R=inf   age=0
           home            pattern=*.dvi  R=inf   age=1
           home            pattern=*.o    R=inf   age=0
           /tmp            pattern=*      R=inf   age=0  # could be risky
           /usr/tmp        pattern=*      R=inf   age=0  #      "
     
     ignore:
     
          .X11