HIRS/package/scripts/common/db_drop.sh
iadgovuser26 iadgovuser26@empire.eclipse.ncsc.mil 84ac9e43a6 updated db_drop script [no ci]
2023-01-19 17:13:46 -05:00

16 lines
427 B
Bash

#!/bin/bash
# Get the current password from the perstence.properties file
file="/etc/hirs/persistence.properties"
# Change java key/value pairs into valid bash key/value pairs
function prop {
grep "${1}" ${file} | cut -d'=' -f2 | xargs
}
user="root"
# user=$(prop 'persistence.db.user')
pwd=$(prop 'persistence.db.password')
# drop the database
mysql -u "$user" --password="$pwd" < /opt/hirs/scripts/common/db_drop.sql