spiri-services/service/roscore.service

16 lines
743 B
Desktop File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[Unit]
After=NetworkManager.service time-sync.target
[Service]
Type=forking
User=spiri
# Start roscore as a fork and then wait for the tcp port to be opened
# —————————————————————-
# Source all the environment variables, start roscore in a fork
# Since the service type is forking, systemd doesnt mark it as
# started until the original process exits, so we have the
# non-forked shell wait until it can connect to the tcp opened by
# roscore, and then exit, preventing conflicts with dependant services
ExecStart=/bin/sh -c ". /opt/ros/melodic/setup.sh; . /etc/ros/env.sh; roscore & while ! echo exit | nc localhost 11311 > /dev/null; do sleep 1; done"
[Install]
WantedBy=multi-user.target