HIRS/package/scripts/common/db_drop.sh
iadgovuser26 iadgovuser26@empire.eclipse.ncsc.mil b6aa61272a added dbus startup to container [no ci]
2023-01-20 21:49:25 +00:00

18 lines
475 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
if pgrep mysqld >/dev/null 2>&1; then
mysql -u "$user" --password="$pwd" < /opt/hirs/scripts/common/db_drop.sql
fi