fm_transmitter icon indicating copy to clipboard operation
fm_transmitter copied to clipboard

run fm_transmitter on startup/headless

Open ghost opened this issue 5 years ago • 4 comments

hi markondej, im using this as a school project and since i won't have access to a computer or a display and keyboard during the demo, is there a way to make the script run automatically on startup? if not, using other programs, can i make the pi output a wifi AP that i can connect to, and then do everything via ssh on my phone?

thanks in advance!

ghost avatar Dec 21 '19 15:12 ghost

To run an executable on startup the simpliest way is to add proper command to /etc/local.rc file, if you want to be more sophisticated register fm_transmitter as an systemd service, see: https://www.linode.com/docs/quick-answers/linux/start-service-at-boot/ In order to make RPi working as an AP please read https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md

markondej avatar Dec 22 '19 22:12 markondej

Do you have a prewritten systemd Service?

micfun123 avatar Nov 19 '21 16:11 micfun123

I'm using the following file to describe my service. I'm using a bash wrapper to supply the fm_transmitter with proper parameters, looping through a folder of wav files. When I stop the service the radio output is not the static noise, which normal, but a mute signal. Starting back up the service is working: I get the sound properly. Only if I'm restarting the raspberry pi solves this behaviour: I get back the static noise, like after a simple playback.

[Unit] Description=fm_transmitterd.sh service After=network.target StartLimitIntervalSec=0

[Service] Type=simple Restart=always RestartSec=1 User=pi ExecStart=/usr/local/bin/fm_transmitterd.sh

[Install] WantedBy=multi-user.target

kzl86 avatar Feb 16 '22 09:02 kzl86

I've solved this issue, which was related to linux signals. According to this doc https://www.man7.org/linux/man-pages/man5/systemd.kill.5.html the default signal is SIGTERM when stopping the service. Now when I stop the fm_transmitter from the cli I use CTRL+C, which is SIGINT.

The solution is to overwrite the default signal in the service description. To do this add the following line to the [Service] section: KillSignal=SIGINT

kzl86 avatar Feb 19 '22 15:02 kzl86