Skip to content

Commit

Permalink
🚑 Make sure the database isn't locked on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck committed Mar 1, 2020
1 parent 38753ba commit d1f780f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions traccar/rootfs/etc/cont-init.d/traccar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
# Home Assistant Community Add-on: Traccar
# Ensures the user configuration file is present
# ==============================================================================
declare host
declare password
declare port
declare username

if ! bashio::fs.file_exists "/config/traccar.xml"; then
cp /etc/traccar/traccar.xml /config/traccar.xml
else
# Existing installation
if bashio::services.available "mysql"; then
# Make sure the database isn't locked
host=$(bashio::services "mysql" "host")
password=$(bashio::services "mysql" "password")
port=$(bashio::services "mysql" "port")
username=$(bashio::services "mysql" "username")

echo "UPDATE DATABASECHANGELOGLOCK SET locked=0;" \
| mysql -h "${host}" -P "${port}" -u "${username}" -p"${password}" \
traccar
fi
fi

0 comments on commit d1f780f

Please sign in to comment.