Skip to content

Instantly share code, notes, and snippets.

@akshithg
Created October 3, 2023 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akshithg/068d9b24b0e030644bb94a8857f7bdb6 to your computer and use it in GitHub Desktop.
Save akshithg/068d9b24b0e030644bb94a8857f7bdb6 to your computer and use it in GitHub Desktop.
Switch neo4j db on community edition
#!/usr/bin/env bash
set -eu
to=$1
active=$(cat /etc/neo4j/neo4j.conf | grep "initial.dbms.default_database" | cut -d'=' -f2)
echo "changing from *$active* to *$to*"
sudo sed -i "s/initial.dbms.default_database=$active/initial.dbms.default_database=$to/g" /etc/neo4j/neo4j.conf
echo "Restarting..."
sudo service neo4j restart
new=$(cat /etc/neo4j/neo4j.conf | grep "initial.dbms.default_database" | cut -d'=' -f2)
if [ "$new" = "$to" ];
then
echo "Success!"
else
echo "Failed!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment