Skip to content

Commit

Permalink
Simplify bash scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtich committed Apr 11, 2023
1 parent 4f4c087 commit 2a84102
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
17 changes: 4 additions & 13 deletions common-script
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@ fi

if [[ "$1" != "help" && "$1" != "export-schema-files" ]]; then
echo "OUTPUT_DIR: ${OUTPUT_DIR}"
if [[ ! -d $PREFIX ]]; then
mkdir -p $PREFIX
fi
mkdir -p $PREFIX
mkdir -p $OUTPUT_DIR

# printf "%s %s> Logging to ${PREFIX}.log"

if [ ! -d ${OUTPUT_DIR} ]; then
mkdir -p ${OUTPUT_DIR}
fi
fi

# die if input files don't exist
Expand Down Expand Up @@ -188,9 +183,7 @@ do_pareto() {

. ./common-variables
if [[ "${WEB_DIR:-}" != "" ]]; then
if [[ ! -d $WEB_DIR/images ]]; then
mkdir $WEB_DIR/images
fi
mkdir -p $WEB_DIR/images
ln -s ${OUTPUT_DIR}/img $WEB_DIR/images/${NAME}
fi
}
Expand Down Expand Up @@ -312,9 +305,7 @@ EOF
}

do_export_schema_files() {
if [[ ! -d marc-schema ]]; then
mkdir marc-schema
fi
mkdir -p marc-schema
printf "%s %s> [avram]\n" $(date +"%F %T")
./export-schema --withSubfieldCodelists > marc-schema/marc-schema.json
./export-schema --withSubfieldCodelists --solrFieldType mixed --withSelfDescriptiveCode > marc-schema/marc-schema-with-solr.json
Expand Down
4 changes: 1 addition & 3 deletions export-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ SPARK_OUTPUT: $SPARK_OUTPUT
OUTPUT_DIR: $OUTPUT_DIR
"

if [[ ! -d $OUTPUT_DIR ]]; then
mkdir $OUTPUT_DIR
fi
mkdir -p $OUTPUT_DIR

while IFS="" read -r p || [ -n "$p" ]
do
Expand Down
4 changes: 1 addition & 3 deletions scripts/timeline/timeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ while true; do
done

HISTORICAL=${BASE_OUTPUT_DIR}/_historical/${NAME}
if [[ ! -d ${HISTORICAL} ]]; then
mkdir -p ${HISTORICAL}
fi
mkdir -p $HISTORICAL

IS_INCREMENTAL=0
if [[ -e ${HISTORICAL}/history.sqlite ]]; then
Expand Down
9 changes: 2 additions & 7 deletions setdir.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@
BASE_INPUT_DIR=your/path
BASE_OUTPUT_DIR=your/path

if [ ! -d $BASE_INPUT_DIR/_reports ]; then
mkdir $BASE_INPUT_DIR/_reports
fi

if [ ! -d $BASE_OUTPUT_DIR ]; then
mkdir $BASE_OUTPUT_DIR
fi
mkdir -p $BASE_INPUT_DIR/_reports
mkdir -p $BASE_OUTPUT_DIR

0 comments on commit 2a84102

Please sign in to comment.