Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-12-2019 06:15 AM
Hello, everyone, I am doing the neo4j admin course and I am stuck on exercise #6 "Scripting changes to the database" I have run into issues with the scripts I have created as they are not running the commands. I am using a UNIX system and using relative paths to locate the scripts
my AddConstraints.cypher script is as follows:
</>
#!/bin/bash
cat ./AddConstraints.cypher | ./../../bin/cypher-shell -u neo4j -p training-helps --format verbose
</>
my AddConstraints.sh script is as follows:
</>
#!/bin/bash
cat ./AddConstraints.cypher | ../../bin/cypher-shell -u neo4j -p training-helps --format verbose
</>
my MaintainDB.sh script is as follows:
</>
#!/bin/bash
rm -rf ./MaintainDB.log
./AddConstraints.sh 2>&1 >> ./MaintainDB.log
</>
my MaintainDB.log script is just an empty file I made from text editor without a hash bang at the top
10-13-2019 12:51 PM
Your AddConstraints.cypher should be a file which contains nothing but cypher statement(s) whereby each statement is terminated by a ;
10-18-2019 07:40 AM
thanks I have made the changes but I am getting the following error from the terminal when I try to run MaintainDB.sh:
Invalid input '#': expected (line 1, column 1 (offset: 0))
"#!/bin/bash"
^
10-18-2019 08:12 AM
what is the content of MaintainDB.sh?
how are you invoking?
10-18-2019 09:14 AM
the contents of the MaintainDB.sh are as follows;
</>
#!/bin/bash
rm -rf ./MaintainDB.log
./AddConstraints.sh 2>&1 >> ./MaintainDB.log
</>
I am calling it via the terminal in its folder by using " sudo ./MaintainDB.sh"
10-18-2019 10:01 AM
i suspect this is a pure linux error and not so much a Neo4j error
if you run
sudo bash -x ./MaintainDB.sh
to which the inclusion of bash -x
should echo every line that is called in the script does this provide more details as to the line causing failure
10-18-2019 11:35 AM
I am using a Mac/Unix... I am not using a Linux machine
10-18-2019 12:50 PM
sorry I do not have/use Mac/Unix.
Does
sudo bash -x ./MaintainDB.sh
result in failure? if so what is the error message?
10-18-2019 01:07 PM
</>
rm -rf ./MaintainDB.log
Invalid input '#': expected (line 1, column 1 (offset: 0))
"#!/bin/bash"
</>
is the error message
10-18-2019 01:24 PM
That's the result when running with 'bash -x' per my last update ????
Are you able to run any shell scripts successfully. This doesn't feel like a Neo4j problem. More like a general OS/scripting issue ?
10-18-2019 01:30 PM
yes that's the result of running "sudo bash -x ./MaintainDB.sh"
yes I can run some shell scripts it seems only those which have echo commands as their content
10-18-2019 01:32 PM
And for the working shell scripts is line 1 defined as
#!/bin/bash
??
10-18-2019 01:35 PM
yes for example the ListProcedures.sh script has the following as its contents and its working perfectly fine:
</>
#!/bin/bash
echo "CALL dbms.procedures() YIELD name;" | ../../bin/cypher-shell -u neo4j -p abcd123 --format plain > ./Procedures.txt
</>
All the sessions of the conference are now available online