We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit fee725d9 authored by clint's avatar clint

our current userdump script

parent 7a3c2284
SELECT username FROM `Users`
#!/bin/sh
USERNAME=turtle
DATABASE=turtle
HOST=localhost
PASSWORD=turtle
cd /home/librefm/turtle/data/ || exit 1
LIST=$(mysql --skip-column-names -h $HOST -u $USERNAME -p$PASSWORD $DATABASE < users.sql)
#we rely on lack of whitespace here
LIST=$(echo "SELECT DISTINCT username FROM Users;" | psql -q)
for I in $LIST; do
cat /home/librefm/scripts/license > /home/librefm/turtle/data/$I.dump
cat /home/librefm/scripts/license > $I.dump.utf8
mysqldump -h $HOST -u $USERNAME -p$PASSWORD $DATABASE Scrobbles "--where=(username='$I')" >> /home/librefm/turtle/data/$I.dump
echo 'COPY (SELECT * FROM Scrobbles where username='"'$I'"') TO STDOUT WITH CSV HEADER;' | psql -q >> $I.dump.utf8
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment