CURRENT SPACE WEATHER
--- CONDITIONS ---
ALERTS | WATCHES | WARNINGS
------------------------------------------
.|| Automated git push + NOAA scraper v3.2 ||.
This script has ran
3
times since it began on 14/10/25
Thu Oct 16 01:11:01 PM MDT 2025
----------------------------------------------
Code: ALTEF3
Issue Time: 2025 Oct 16 0930 UTC
CONTINUED ALERT: Electron 2MeV Integral Flux exceeded 1000pfu
Potential Impacts: Satellite systems may experience significant charging resulting in increased risk to satellite systems."
Wed Oct 15 01:10:03 PM MDT 2025
----------------------------------------------
Code: SUM10R
Issue Time: 2025 Oct 15 1615 UTC
SUMMARY: 10cm Radio Burst
Tue Oct 14 08:07:51 PM MDT 2025
----------------------------------------------
Code: WATA30
Issue Time: 2025 Oct 14 1943 UTC
WATCH: Geomagnetic Storm Category G2 Predicted
Potential Impacts: Area of impact primarily poleward of 55 degrees Geomagnetic Latitude.
No Data
---------------------------------------------------
Code: no data
Issue Time: no data
ALERT/WATCH/SUMMARY: no data
potential impact: no data
description: no data
No Data
---------------------------------------------------
Code: no data
Issue Time: no data
ALERT/WATCH/SUMMARY: no data
potential impact: no data
description: no data
No Data
---------------------------------------------------
Code: no data
Issue Time: no data
ALERT/WATCH/SUMMARY: no data
potential impact: no data
description: no data
No Data
---------------------------------------------------
Code: no data
Issue Time: no data
ALERT/WATCH/SUMMARY: no data
potential impact: no data
description: no data
--END OF TRANSMISSION--
ABOUT:
This experiment was to try to auto-update my website using a bash script to edit my .html file
First the script curls and parses the json from this NOAA site that has public alerts/warnings on space weather conditions. Then it filters for only the first message/alert.
This is a big chunk of data, so first step is making it usable and pulling out the peices I want. I do this by first replacing the ansi escape sequence codes "\r\n" with a single character "%". This allows me to use IFS (Internal Field Sperator) command to turn every string between two % into an an index in an array.
Now I can pull the code/issue date/and alert message cleanly out, since these strings are always on the same index.
Some messages however, come with either a "Potential Impact:" or a "Description:" depending on the type of alert. So next I have a while loop that goes through the array and if the first word starts with "potential" or "description" it will store that index into a variable
That was the hard part. Next is simply insterting these variables into a chunk of formatted html, appending them to my.html file and deleting the last chunk, so as to only have 7 days worth of data.
the formatted html looks something like this
<div>
<p>${script-time/code/issue-time/alert/}</p>
<p>${potential-impacts}</p>
<p>${description}</p>
</div>
If my potential-impact/description variables have no value then it leaves it blank between <p></p> which works perfectly as it doesn't affect how the html is rendered by web browsers. Importantly the number of html lines remains the same weather there was a value or not. Meaning the html chunks will always be 5 lines, regardless of the data. So it won't get messed around when the script deletes the last chunk
Next is pulling the line of html of the counter for the number of times the script has ran. My script takes the number, adds 1, then replaces it in the .html document.
Finally my script changes directories to my websites repo, and then git add/commit/pushes the new file to the remote. Done like dinner
This took some fiddling to properly automate. Trying to run from cron.daily would try running it as root, so I'd get git permission errors when trying to git push. The solution was to specify at the start of the bash script to check if its running as root. If true (which it always will be) then run the command to switch to my username. Since it will always be the case you dont need any "else" function. ezpz