Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Scavo committed Oct 18, 2016
2 parents 41a6e2e + efafb11 commit 3fd2dcb
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Bash Library

A library of re-usable bash scripts

## Installation

Download the source, change directory to the source directory, and install the source into ``/tmp`` as follows:

```Shell
$ export BIN_DIR=/tmp/bin
$ export LIB_DIR=/tmp/lib
$ ./install.sh $BIN_DIR $LIB_DIR
```

or install into your home directory:

```Shell
$ export BIN_DIR=$HOME/bin
$ export LIB_DIR=$HOME/lib
$ ./install.sh $BIN_DIR $LIB_DIR
```

A given target directory will be created if one doesn't already exist. In any case, the following files will be installed:

```Shell
$ ls -1 $BIN_DIR
cget.sh

$ ls -1 $LIB_DIR
command_paths.sh
compatible_date.sh
compatible_mktemp.sh
conditional_get.sh
extract_entity.xsl
http_tools.sh
md_tools.sh
```

## Overview

Bash script ``cget.sh`` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is output instead.

```Shell
$ MD_LOCATION=http://md.incommon.org/InCommon/InCommon-metadata.xml
$ export CACHE_DIR=/tmp/http_cache
$ $BIN_DIR/cget.sh $MD_LOCATION > /dev/null
$ echo $?
0
$ ls -1 $CACHE_DIR
885d2eedcad7d0355da5bb9e648833ec_content
885d2eedcad7d0355da5bb9e648833ec_headers
$ cat $CACHE_DIR/885d2eedcad7d0355da5bb9e648833ec_headers
HTTP/1.1 200 OK
Date: Mon, 17 Oct 2016 17:26:58 GMT
Server: Apache
Last-Modified: Fri, 14 Oct 2016 19:07:55 GMT
ETag: "190004-24ddf06-53ed7f18d18c0"
Accept-Ranges: bytes
Content-Length: 38657798
Connection: close
Content-Type: application/samlmetadata+xml
```

See the inline help file for details:

```Shell
$ $BIN_DIR/cget.sh -h
```

## Compatibility

Shell scripts are compatible with both GNU/Linux and Mac OS. XSLT scripts are written in XSLT 1.0.

## Dependencies

None

0 comments on commit 3fd2dcb

Please sign in to comment.