Startup trunk-recorder and radio-scanner on RPI boot
Opened this issue · 6 comments
trying to setup a @reboot script to start trunk-recorder in one tty session and also start radio-scanner in another tty session since both need to run simultaneously. here is the script I have but seems both try to run in the initial tty window and the rdio-scanner will only run after the trunk-recorder is killed.
#!/bin/bash
date >> date.txt
setsid sh -c 'exec commmand <> /dev/tty2 >&0 2>&1'
/home/pi/trunk-build/trunk-recorder --config /home/pi/trunk-build/config.json
#openvt -c 2
setsid sh -c 'exec commmand <> /dev/tty3 >&0 2>&1'
/home/pi/trunk-build/rdio-scanner/rdio-scanner
While I have not dug into the pipe transitions here, just based on the process order of operations, you might need to background the processes if the desire isn't to hold them open from this script.
The problem is both scripts need to run at the same time. This configuration only fires the trunk-recorder and not the Rdio-scanner until after the trunk-recorder is killed
tmux appears to be a way around this but I'm not sure how to script that?
If you're asking about a headless system on an RPI, I'm assuming it's running systemd.
Have you set these up to not run behind systemd? How have you set these up to run initially?
Edit: Without digging into the system structure it self, you could probably slap a &
at the end of the command calls in that script to accomplish what you're after; however, do note this might present additional issues depending on how the system is setup.
Example:
#!/bin/bash
date >> date.txt
setsid sh -c 'exec commmand <> /dev/tty2 >&0 2>&1'
/home/pi/trunk-build/trunk-recorder --config /home/pi/trunk-build/config.json &
#openvt -c 2
setsid sh -c 'exec commmand <> /dev/tty3 >&0 2>&1'
/home/pi/trunk-build/rdio-scanner/rdio-scanner &
If it helps, just set Rdio-Scanner as a service. That way, Rdio-Scanner will always start on reboot and your can set up a @reboot
crontab to start TrunkRecorder on every reboot. My @reboot
crontab for my headless RPis point to a script containing the following text:
#!/bin/sh
sleep 1m
cd /home/truser/trunk-build
/home/truser/trunk-build/trunk-recorder --config={configuration file name}.json
-or-
You can just start your tmux
session and manually start TrunkRecorder then "detach" since Rdio-Scanner will already be running as a service.