Skip to content

Script Manual

Zengineer edited this page May 9, 2017 · 1 revision

This is a manual for the bashscript. In this manual, each line of the bashscript will be detailed explained, so when new partners join this team, or there are some new user, they can quickly understand the bashscript and get ready to work on this project. This is a manual for the bashscript. In this manual, each line of the bashscript will be detailed explained, so when new partners join this team, or there are some new user, they can quickly understand the bashscript and get ready to work on this project.

Following is the manual, based on this bashscript.

echo "Get Neo4j from S3 ... "

Prompt information.

aws s3 --region us-west-2 cp "s3://neo4j.rd-switchboard/cambridge/cambridge-enriched-2016-10-03.tar.gz"

This line will get the neo4j from S3. This bash script is for the data provides by University of Cambridge, so the source file is cambridge-enriched-2016-10-03.tar.gz. When a user want to perform this action to any other dataset, he/she can replace this source file from S3.

echo "Extract the files ..."

Prompt information.

tar xvzf cambridge-enriched-2016-10-03.tar.gz

This line will extract the files into the current path. As the same, if a user is working on any other dataset, he/she should change the target file name.

echo "Go to Neo4j folder ... "

Prompt information.

cd neo4j-enriched-2016-10-03/

As we have extracted the files, we need to cd into this folder, the name of the folder depends on the original content of the tar.gz file.

echo "Install neo4j-shell tools"

Prompt information.

curl http://dist.neo4j.org/jexp/shell/neo4j-shell-tools_3.0.1.zip -o neo4j-shell-tools.zip

This line takes the response to download the neo4j-shell-tool from the link in the bashscript.

unzip neo4j-shell-tools.zip -d lib

This line will unzip the zip file which is just downloaded and install the neo4j-shell-tool

chmod +x ./bin/neo4j-shell

This line will make the neo4j-shell-toll executable

echo "Export GraphML"

Prompt information.

./bin/neo4j start

Start the neo4j server.

sleep 10s

Sleep 10 seconds to allow user read the messages.

./bin/neo4j-shell -c -file  ../export-cambridge-gephi.cli

Export the graphml file following the query in the .cli file

sleep 10s

Sleep 10 seconds to allow user read the messages.

./bin/neo4j stop

Stop the neo4j server

echo "Copy to S3"

Prompt information.

NOW="$(date +'%Y-%m-%d')"

The current timestamp.

sudo zip "cambridge-graph-$NOW.zip" out.graphml

Zip the output file to a zip file

aws s3 --region us-west-2 cp "cambridge-graph-$NOW.zip" "s3://graphml.rd-switchboard/cambridge/"

Upload the zip file to S3.

Clone this wiki locally