I’m happy to announce that my Pi MAME Manager script is done. Done enough to tag it as version 1.0.0 that is.
- Use a USB external battery brick – like what you’d use to extend the battery life on your cell phone – to pipe power to the Raspberry Pi.
- Plug a cheap ethernet switch into the Raspberry Pi’s ethernet port.
- Run my PiMameManager script.
The script will launch MAME if the power is up. If the power drops off, the script will detect the loss of signal to the ethernet port. The Raspberry Pi will continue to run because of the external battery. When the script identifies a power outage it will kill the MAME process. If the power is restored, the script will relaunch MAME, simulating a reset. If the power crosses the battery threshold it will gracefully shutdown the Raspberry Pi.
Now, to capture a few of my thoughts that don’t exist elsewhere:
- The script was designed with Raspbian Jessie in mind
- The script was tested with Advance MAME
- I tried to make the script easy to configure so you can use it with other OSes, MAME versions
- The script largely just wraps Bash functions
- I probably could have used Bash script instead of Perl, but I felt like my Bash was more rusty than my Perl
- Out of the box, the script can be run at start up, but it could easily be configured to run as a daemon or a cron job instead.