Reputation: 15
I am trying to automatically start a Domain Manager, Device Manager, and waveform at boot on a CENTOS 7 OS using REDHAWK 2.0.7.
First I created a python script -rwxrwxrwx. 1 root root 1518 /usr/local/sbin/rx.py
I verified the script works as intended when run by calling python /usr/local/sbin/rx.py
and inspecting the REDHAWK IDE. It works as intended 100%.
Next I created a systemd service -rwxrwxrwx. 1 root root 188 /etc/systemd/system/rx.service
[Unit]
Description=REDHAWK Service
Requires=omniEvents.service
[Service]
Type=idle
ExecStart=/usr/bin/python /usr/local/sbin/rx.py
User=redhawk
[Install]
WantedBy=multi-user.target
Finally I started this service with the following steps:
sudo systemctl daemon-reload
sudo systemctl enable rx.service
sudo systemctl start rx.service
Then I checked the status via systemctl status rx.service
and saw it had failed due to:
File "/usr/local/redhawk/core/lib/python/ossie/utils/popen.py", line 59, in Popen
return subprocess.Popen(*args, **kwargs)
File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1327 in _execute_child
raise child_exception
TypeError: execv() arg 2 must contain only strings
I have isolated the problematic line to
domain = rh.kickDomain(domain_name="REDHAWK_DEV", kick_device_managers=True, device_managers=['/nodes/NUC1Node/DeviceManager.dcd.xml'])
which comes after the following imports
import sys
import os
from time import sleep
sys.path.append(os.path.abspath("/usr/local/redhawk/core/lib64/python"))
sys.path.append(os.path.abspath("/usr/local/redhawk/core/lib/python"))
from ossie.utils import redhawk as rh
I have tried encapsulating in a try except block to obtain more information, but the error above is the most informative thing I've found and it still doesn't seem to highlight what I'm missing. As I've said, this script runs perfectly when run manually; it is just failing as a systemd service which leads me to believe there is something else the systemd process needs in order to run this properly.
Does anyone know how I can fix this process of starting a REDHAWK Domain Manager at boot, or have a different working method that I could adapt and implement?
Upvotes: 0
Views: 161
Reputation: 26
I repeated your setup but had systemd source a script(runRx.sh
) instead of running the python command directly. When I didn't source the /etc/profile.d/redhawk-sdrroot.sh
file, I got the same error.
The working runRx.sh
file contained:
#!/bin/bash
source /etc/profile.d/redhawk.sh
source /etc/profile.d/redhawk-sdrroot.sh
/usr/bin/python /usr/local/sbin/rx.py
REDHAWK 2.1.3 contains a new redhawk-adminservice rpm that is meant to assist in automatically starting up domains, nodes and waveforms on both CentOS 6 and CentOS 7. See https://redhawksdr.github.io/2.1.3/manual/appendices/adminservice/ for more information.
Upvotes: 0