Skip to content

Commit

Permalink
fix auto postgres exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Dec 25, 2024
1 parent 0b6342e commit 1a82159
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/data-hoarder/postgres.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
OUT_FOLDER=/var/lib/pub-files/postgres-dumps/$(date -d"$(date) - 1 day" +"%Y-%m")
CSV_FILENAME=$(date -d"$(date) - 1 day" +"%Y-%m-%d").csv
psql -d tlms -c "COPY (SELECT id, to_char(time::timestamp at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') time, station, r09_type, delay, reporting_point, junction, direction, request_status, priority, direction_request, line, run_number, destination_number, train_length, vehicle_number, operator, region FROM r09_telegrams WHERE time::date = current_date - 1 ORDER by time ASC) TO '$TMPFILE' DELIMITER ',' HEADER CSV;"
psql -d tlms -c "COPY (SELECT id, to_char(time::timestamp at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS') time, station, r09_type, delay, reporting_point, junction, direction, request_status, priority, direction_request, line, run_number, destination_number, train_length, vehicle_number, operator, region FROM r09_telegrams WHERE time > now() - interval '24 hours' ORDER by time ASC) TO '$TMPFILE' DELIMITER ',' HEADER CSV;"
mkdir -p $OUT_FOLDER
chmod a+xr $OUT_FOLDER
Expand Down

0 comments on commit 1a82159

Please sign in to comment.