coup-de-foudre / tesla_coil_fm_driver

Raspberry-pi driver for a musical tesla coil
https://www.coupdefoud.re/
2 stars 5 forks source link

Systemd configuration to autostart on boot #18

Closed mcscope closed 7 years ago

mcscope commented 7 years ago

I added documentation on how to configure the fm_transmitter to auto-start on boot, and on process failure. This uses systemd, which is the powerful new init system for linux. There's a single file that should be moved to /lib/systemd/system. I have included instructions for how to do this to the README, as well as some useful commands for interacting with systemd.

I envision we might want to alternate between usb auto and canned music, and unfortunately, I didn't find an easy way to change the command line options in the systemd script. There is some environmental variable schenanigans that we can do, or we could make two services, one for each option (fm_transmit_live, fm_transmit_canned ?)

We're also working on a preconfigured image for the pi, and we aim to have this demonization pre-installed.

This addresses issue https://github.com/coup-de-foudre/FM_transmitter/issues/12

mbmccoy commented 7 years ago

This is great. One request:

Since systemctl stop ... sends a SIGTERM and not a SIGINT, can you also register the handler in main.cpp? (And probably rename sigIntHandler to signalShutdownHandler?) You can tell it's correctly shut down if it goes back to static after a few seconds.

mbmccoy commented 7 years ago

Also, not for this PR, but if you have thoughts for how to gracefully shut these down at the burn without logging in, I'm all ears.

(A simple push switch and wire it up to a hardware interrupt, for example...)