Skip to content

ikluft/AlertGizmo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AlertGizmo

AlertGizmo originated as scripts I wrote to monitor space-related alerts online. The common code among the scripts was pulled together into the AlertGizmo module. These can be run manually or from crontabs. (see example below)

Directory structure

  • bin (script directory)
  • lib (library directory)
    • AlertGizmo.pm - base class for AlertGizmo feed monitors
    • AlertGizmo/Config.pm - configuration data for AlertGizmo classes
    • AlertGizmo/Neo.pm - AlertGizmo monitor for NASA JPL Near-Earth Object (NEO) close approach data
    • AlertGizmo/Swpc.pm - AlertGizmo monitor for NOAA Space Weather Prediction Center (SWPC) alerts, including aurora

Running from a crontab

To run AlertGizmo from a crontab, first use 'crontab -l' to determine if you have one set up, and that the crontab command is installed. (If it isn't installed, Linux packages such as cronie can perform modern cron functions. If on a small embedded Linux system, BusyBox or Toybox also provide a crontab command.)

When run in normal mode, the scripts pull new data from the network. When run in test mode with the --test flag on the command line, they use saved data from prior network accesses but do not make a new network access.

If you have a crontab already, preserve its contents by saving it to a file we'll call 'my-crontab' with this command:

crontab -l > my-crontab

Otherwise create the 'my-crontab' file empty from scratch with a text editor.

Add these lines to the 'my-crontab' file, replacing "path/to/script" with your path where these scripts are installed and using your local time zone instead of US/Pacific (the author's local time zone).

CRON_TZ=UTC

# access NASA JPL NEO API 8 times per day and just after midnight UTC
1 0 * * *       $HOME/path/to/script/pull-nasa-neo.pl --tz="US/Pacific"
31~44 */3 * * * $HOME/path/to/script/pull-nasa-neo.pl --tz="US/Pacific"

# access NOAA Space Weather Predition Center alerts every 2 hours
11~24 */2 * * * $HOME/path/to/script/pull-swpc-alerts.pl --tz="US/Pacific"

Then install the crontab by running:

crontab my-crontab

Ongoing experimentation

The SWPC alert script is derived from the NEO script. So they had common code. Before making more similar scripts, it was considered a good idea to make modules to combine their common features. That became AlertGizmo. Now the door is open to add more modules on that foundation.

An outage in Tom Taylor's Mastodon "Low Flying Rocks" bot led me to the conclusion I should expand these to be able to post on Mastodon. I was already inspired by XKCD comic #2979 "Sky Alarm" to go in that direction. XKCD comic #2979 "Sky Alarm"

About

monitor space-related alerts online

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages