Uploaded image for project: 'OODT (Retired)'
  1. OODT (Retired)
  2. OODT-306

File Manager Tools for BASH and TCSH

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 0.4
    • file manager
    • None
    • *nix OS

    Description

      Chris Mattmann has been writing some really useful shell alias commands to help with some of the really repetitive tasks that tend to appear when using the File Manager component. This issue will be used to share and commit 2 files that contain environment settings that can be easily sourced, or just copied into a users .bashrc or .tcshrc startup file.

      The files will contain the scripting commands and some basic documentation.

      I plan to drop the files into oodt/filemgr/src/main/resources since they really only apply to the filemanager.

      Here is my initial working Docu-Code (for BASH) I plan to clean up and commit.

      #####  Copy and Paste this Block into the .bashrc of your deployment user account ##########
      #
      # The following aliases must be used within a filemgr installation's
      # bin directory since relative pathing is being used.  This block also
      # assumes that the filemgr is running on port 9000 (the default port of filemgr)
      #
      alias fmquery="java -Dorg.apache.oodt.cas.filemgr.properties=../etc/filemgr.properties -Djava.ext.dirs=../lib org.apache.oodt.cas.filemgr.tools.QueryTool --url http://localhost:9000 --lucene -query "
      #
      alias fmdel="java -Dorg.apache.oodt.cas.filemgr.properties=../etc/filemgr.properties -Djava.ext.dirs=../lib org.apache.oodt.cas.filemgr.tools.DeleteProduct --fileManagerUrl http://localhost:9000 --read"
      #
      alias metdump="java -Djava.ext.dirs=../lib org.apache.oodt.cas.filemgr.tools.MetadataDumper --url $FILEMGR_URL --out . --productId "
      #
      ######## END OF BLOCK #######
      

      Previous Commands Explained

      fmquery

      This will execute a Lucene Query against the filemanager catalog and return a list of ProductIDs. These Product IDs can then be piped into the fmdel alias to remove all products that match the query criteria.

      Usage:

      • Return the ProductIds to the terminal window -
        fmquery "ProductType:ISMRawData"
      • Pipe the ProductIds to a file -
        fmquery "ProductType:ISMRawData" > ProductID_List.txt

      fmdel

      Use this command to delete a single product from the catalog. This will remove the lucene index entry from the catalog and will remove the archived product from disk. (If you just want to see what products will be removed from the archive, then you will need to add the --nocommit parameter to the fmdel command alias after the --read param)

      Usage:

      • Remove one product from the catalog
        fmdel 0691ee17-96ec-11e0-8556-3b3ca12e4f64
      • Remove a set of products from the catalog using the fmquery command
        fmquery Metadata_Key:"Matching_Key_Value" | fmdel
        For example: To remove all Products with a GenericFile ProductType use
        fmquery ProductType:"GenericFile" | fmdel

      metdump

      Just added to the list. This will take in a product_id and dump out the product's metadata into the current directory. This one needs a little more testing and docs.

      Comments are welcome.

      Attachments

        1. bash_aliases.txt
          2 kB
          Cameron Goodale
        2. tcsh_aliases.txt
          2 kB
          Cameron Goodale

        Activity

          People

            cgoodale Cameron Goodale
            cgoodale Cameron Goodale
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: