Sorry for the incorrect P(DROP)>90% emails! It took me a long time to figure out why this was happening. Anyways, here's the summary:
I made this website in about 10 minutes, so the code is pretty jank. But essentially, there are two functions: getprob.sh, which gets the probability of it being joever, and joemai.sh, which sends out emails if the probabilty has hit any of the relevant thresholds. getprob.sh writes the probability to a file—probability.txt—and joemail.sh reads the probability from this file.
Anyways, this is sketchy, but should be all well and good so long as the two functions aren't run at the same time. Thus, I made my crontab look like this:
*/2 * * * * /home/elecnwjd/getprob.sh 1-59/2 * * * * /home/elecnwjd/joemail.sh >> email_log_for_joemail.txt
(This means that getprob.sh runs every even minute, and joemail.sh runs every odd minute.)
Now, this morning I wake up to a P(DROP)>90% email. I check isitjoever.com, and...it's back to 45%. Joe Biden hasn't dropped out!
So, I start looking through the log file (email_log_for_joemail.txt). In it, I see the following culprit:
2024-07-13 06:40:02 - Script started 2024-07-13 06:40:02 - Using probability file: isitjoever.com/probability.txt 2024-07-13 06:40:02 - Using subscribers file: isitjoever.com/subscribers.csv 2024-07-13 06:40:02 - Current probability: 1.0000 2024-07-13 06:40:02 - Probability is outside normal range. Processing subscribers. 2024-07-13 06:40:02 - Processing subscriber: andrew2000g@gmail.com 2024-07-13 06:40:02 - Probability > 90% for andrew2000g@gmail.com 2024-07-13 06:40:02 - Email sent successfully to andrew2000g@gmail.com with subject 'P(DROP)>90%' 2024-07-13 06:40:02 - Updating subscriber file for andrew2000g@gmail.com, column g90 2024-07-13 06:40:02 - Subscriber file updated
But wait!! 40 is an even minute!! Why is this command running at all??
(This explains why the false alarm was sent—getprob.sh was likely in the process of updating probability.txt, and so joever.sh somehow parsed the file incorrectly—leading to everyone being notified)
Well, turns out, the server I'm hosting isitjoever.com on doesn't allow cron jobs to run more often than every 2 minutes. So, at some point during the night, my crontab was rewritten to
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/elecnwjd/getprob.sh 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/elecnwjd/joemail.sh >> email_log_for_joemail.txt
Leading to both commands being run at the same time!
Anyways, sorry about that, everyone. Those responsible have been punished. Joe Biden is not dropping out