Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using mon with systemd type service #181

Open
tugbakara opened this issue Oct 12, 2023 · 2 comments
Open

using mon with systemd type service #181

tugbakara opened this issue Oct 12, 2023 · 2 comments

Comments

@tugbakara
Copy link

tugbakara commented Oct 12, 2023

Hi, I want to use mon with system servise as:

[Unit]
Description=Robot Bringup Launch Service
After=network.target

[Service]
Type=simple
ExecStart=/bin/bash -c "source /path/to/my/ws/devel/setup.bash && mon launch abcd.launch"
ExecStop=/usr/bin/pkill -f "mon launch diffbot_base abcd.launch"
Restart=always

[Install]
WantedBy=multi-user.target

but I couldn't run this, and there is not any error, how can I make it run, or does mon support service?

@tugbakara
Copy link
Author

sudo systemctl --all | grep mon_deneme
● mon_deneme.service   loaded    failed     failed    Robot Bringup Launch Service                                                    

@xqms
Copy link
Owner

xqms commented Oct 12, 2023

Here's a typical systemd unit file we have been using:

[Unit]
Description=My ROS service
After=network-online.target
Wants=network-online.target
Requires=roscore.service
AssertPathExists=/opt/ros

[Service]
Type=simple
User=my_username
TasksMax=infinity
KillSignal=SIGINT
ExecStart=/bin/bash -c ' \
  source /home/my_workspace/install/setup.bash && \
  rosrun rosmon_core rosmon --name rosmon_context --disable-ui --flush-stdout --log /tmp/context.log PKG launchfile.launch \
'

[Install]
WantedBy=default.target

and we start the roscore using another unit file (roscore.service):

[Unit]
Description=ROS Master
After=network-online.target
After=smbd.target
Wants=network-online.target
Wants=smbd.target
AssertPathExists=/opt/ros

[Service]
Type=simple
User=my_username
SyslogIdentifier=roscore
TasksMax=infinity
KillSignal=SIGINT
ExecStart=/bin/bash -c ' \
  source $${ROS_SETUP:=/opt/ros/noetic/setup.bash} && \
  exec /opt/ros/noetic/bin/roscore -w 20 -t 8 \
'

[Install]
WantedBy=default.target

(the smbd.target is probably not required in your case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants