Greenfish
Greenfish

Reputation: 378

docker mkdir won't create a directory

I am trying to run a bash script which should load data into jena. This script comes from a github repository and was allegedly working on the owner's machine but on mine it won't run, even though I followed the instructions. So let me first describe what the script does based on my understanding: It should load .nt data (RDF data) into Jena using docker by using the docker image of jena, named stain/jena. Here is the script:

#/bin/bash
files=$(echo $(pwd)/rawdata-bearb/hour/alldata.IC.nt/*.nt | sed "s%$(pwd)/rawdata-bearb/hour/alldata.IC.nt%/var/data/in%g")
mkdir output # added

for file in $files; do
    v=$(echo $file | sed "s/^.*\/\([0-9][0-9]*\)\.nt$/\1-1/" | bc)
    echo "$v"
    mkdir -p /var/data/out/ic/$v
    time docker run \
        -it \
        --rm \
        -v $(pwd)/tdb-bearb-hour/:/var/data/out/ \
        -v $(pwd)/rawdata-bearb/hour/alldata.IC.nt/:/var/data/in/ \
        stain/jena /jena/bin/tdbloader2 \
            --sort-args "-S=16G" \
            --loc /var/data/out/ic/$v $file \
            > output/load-bearb-hour-ic-$v-.txt
done

However, when I execute the script, I get following message from the saved log file:

13:12:46 INFO -- TDB Bulk Loader Start
mkdir: cannot create directory ‘/var/data/out/ic/0’: No such file or directory
13:12:46 ERROR Failed during data phase

According to the tdbloader2 manual the --loc parameter should create the directory if it does not exist

-- loc: Sets the location in which the database should be created.
This location must be a directory and must be empty, 
if a non-existent path is specified it will be created as a new directory.

I created the directories /var/data/out/ic/0 - /var/data/out/ic/10 manually and re-executed the script. Still, I got the same error message. My first guess was that tdbloader2 or docker use the mkdir command without the -p parameter but since I manually created the directories, thus, they existed before the execution and I still got the same error, it must be something else. I am kindly asking for your help

Upvotes: 2

Views: 1134

Answers (0)

Related Questions