Software, scripts and configurations for the Magson fluxgate magnetometer MFG-1S at the TPSO observatory near Victor Harbor in South Australia
Scripts and configuration for the data server and web frontend
Export Data
The exported csv files for a whole year would get quite big and we might run out of disk space. That's why we split the export in 2 halfs (01.01.YYYY ... 31.07.YYYY and 01.08.YYYY ... 31.12.YYYY)
- Edit the export script /home/midiwidi/Projects/TPSO/tpso_db_export.sh and make sure the DB user postgres password is specified and adjust start and end date to YYYY-01-01 ... YYYY-07-31 (format YYYY-MM-DD)
- Delete the folder /home/midiwidi/Projects/TPSO/export/YYYY (YYYY is the year to backup) if there is one
- run /home/midiwidi/Projects/TPSO/tpso_db_export.sh and wait until it finishes
- Optional: check /home/midiwidi/Projects/TPSO/export/YYYY for the exported data
- cd to /home/midiwidi/Projects/TPSO/export/YYYY and zip the data with 'zip -r YYYY.zip YYYY'
- Download the zip file using WinSCP and extract the data
... and repeat everything with the second half of the year
- Edit the export script /home/midiwidi/Projects/TPSO/tpso_db_export.sh and adjust start and end date to YYYY-08-01 ... YYYY-12-31 (format YYYY-MM-DD)
- Delete the folder /home/midiwidi/Projects/TPSO/export/YYYY and the zip file
- run /home/midiwidi/Projects/TPSO/tpso_db_export.sh and wait until it finishes
- Optional: check /home/midiwidi/Projects/TPSO/export/YYYY for the exported data
- cd to /home/midiwidi/Projects/TPSO/export/YYYY and zip the data with 'zip -r YYYY.zip YYYY'
- Download the zip file using WinSCP and extract the data (into the same directory as the data of the first half of the year)
- Delete the folder /home/midiwidi/Projects/TPSO/export/YYYY and the zip file
Generate Preview Images
- Edit the export script /home/midiwidi/Projects/TPSO/tpso_db_export_thumbnails.sh and adjust start and end date to YYYY-01-01 ... YYYY-12-31 (format YYYY-MM-DD)
- Run /home/midiwidi/Projects/TPSO/tpso_db_export_thumbnails.sh and wait until it finishes
- Optional: check /home/midiwidi/Projects/TPSO/export/YYYY/thumbnails for the exported images
- Download the image files using WinSCP
- Delete the folder /home/midiwidi/Projects/TPSO/export/YYYY including the image files
Every hour, the script tpso_db_delete_oldest.sh is started by a cronjob. It removes data which is older than 426 days (1 year and 2 month). The 2 month should be enough time for the annual export so that no data is lost.
crontab -e
0 * * * * /home/midiwidi/Projects/TPSO/tpso_db_delete_oldest.sh