MSR Scripts

Scripts that query MSR are located on the web host at /home/rmvr/bin.

The developer’s guide to the MSR API is located at REST API for Racing, Driving and Social event registration

Script crontab

55 23 * * * cd ~/bin;/usr/local/bin/php ./vehicle-report.php >> $HOME/logs/user/rmvr-vehicle-report.log 2>&1
54 23 * * * cd ~/bin/;/usr/local/bin/php ./entry-reports.php >> $HOME/logs/user/rmvr-entry-reports.log 2>&1
53 23 * * * cd ~/bin;/usr/local/bin/php ./member-report.php >> $HOME/logs/user/rmvr-member-report.log 2>&1
0 14 * * Mon cd ~/bin;/usr/local/bin/php ./pob-reminder.php >> $HOME/logs/user/rmvr-pob-reminder.log 2>&1

entry-reports.php

The entry reports script pulls all future race assignments and attendees and concatenates the data into a single $assignments array. It has four modules:

  • License report:
    Looks for entries without a current RMVR competition license, and sends a list to the Chief Driving Instructor.
  • Logbook report:
    Looks for entries without a current log book, and sends a list to the Chief of Eligibility.
  • Medical report:
    Looks for entries without a medical exam, or a medical exam that will expire before the race. For each entry, the scripts sends an email to the RMVR administrator and to the entrant.
  • Tech report:
    Looks for entries with provisional or “NeedsFix” RMVR log books. For each entry, the scripts sends an email to the Chief of Tech and to the entrant.

vehicle-report.php & member-report.php

These scripts pull lists of all vehicles and members and save them to /home/rmvr/assets/msr_backups in xslx format. Two copies of each file are saved: one named “latest_{vehicles|members}.xslx” which is overwritten every day and one named “{YYYY-MM-DD}_{vehicles|members}.xlsx”. Bob Alder has set up Google document macros that look for the latest version of each file and format them as Google Sheets for eligibility use.

pob-reminder.php

This script has nothing to do with MSR. It sends an email to Pak Mail every Monday morning to remind them to send any accumulated snail mail to the RMVR Administrator. This script will need to be updated with the admin’s snail mail address if and when that changes.

Utilities

A couple of utility scripts are helpful when creating new scripts and debugging:

  • get-assignments.php returns the concatenated assignment and member data
  • get-attendees.php iterates through all upcoming events and returns attendee data for each event
  • get-events.php iterates through all upcoming events and returns ID, name and type for each event
  • get-member.php requires a member URI as input and returns the data for that member