Compare commits

...

2 Commits

Author SHA1 Message Date
simon f8e06fb9c0
fix key map for vunhealthy range 2023-03-25 12:49:36 +07:00
simon 0dc77b3d54
delete pg source files for dbsync 2023-03-25 12:49:12 +07:00
2 changed files with 18 additions and 4 deletions

View File

@ -12,17 +12,25 @@ echo "---------------------------------------"
printf "\n -> backup\n"
ssh $remote_host 'docker exec postgres pg_dump -U aqi | gzip > backup.gz'
printf "\n -> download\n"
rsync --progress -r --delete-after -e ssh $remote_host:backup.gz /tmp/backup.gz
rsync --progress -r --remove-source-files -e ssh $remote_host:backup.gz /tmp/backup.gz
# sync
printf "\n -> sync\n"
rsync --progress -r --delete-after /tmp/backup.gz -e ssh $local_host:backup
rsync --progress -r --remove-source-files /tmp/backup.gz -e ssh $local_host:backup
ssh $local_host 'gzip -df backup/backup.gz'
# replace
printf "\n -> replace\n"
ssh $local_host "docker exec -i postgres psql -U aqi -c 'DROP TABLE IF EXISTS aqi;'"
ssh $local_host "docker exec -i postgres psql -U aqi -c 'DROP TABLE IF EXISTS weather;'"
ssh $local_host "docker exec -i postgres psql -U aqi -c \
'DROP SCHEMA public CASCADE;'"
ssh $local_host "docker exec -i postgres psql -U aqi -c \
'CREATE SCHEMA public;'"
ssh $local_host "docker exec -i postgres psql -U aqi -c \
'DROP TABLE IF EXISTS aqi;'"
ssh $local_host "docker exec -i postgres psql -U aqi -c \
'DROP TABLE IF EXISTS weather;'"
ssh $local_host 'docker exec -i postgres psql -U aqi -d aqi < backup/backup'
ssh $local_host "trash backup/backup"
printf "\n -> done\n"

View File

@ -77,6 +77,12 @@ def chart_fill(plt, y_ticks):
"color": "#be4173",
"name": "vunhealthy",
},
250: {
"low": 200,
"high": 300,
"color": "#be4173",
"name": "vunhealthy",
},
300: {
"low": 300,
"high": y_ticks[-1],