Ask Your Question

roslaunch command does not run when put in crontab

asked 2012-05-07 16:01:48 -0500

clark gravatar image

I am setting crontab to let my computer to launch certain ros package when it starts up or reboots.

here is the content I put in crontab -e, @reboot bash -c '/home/user/'

while the file simply contains a single roslaunch command,


roslaunch socket_server socket.launch

The above .sh file confirms running fine in terminal, but every time when the pc (re)boots, the roslaunch commmand doesn't run as expected; and I can't even find any records in the sys log file.

Can anybody with experience on cron + ros configuring help?

thanks clark

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-05-07 17:06:26 -0500

joq gravatar image

You need to set up the ROS environment in the shell script.

edit flag offensive delete link more


Thanks for the quick help. You are totally right. After adding "source /opt/ros/electric/setup.bash" into the sh script, it works now

clark gravatar image clark  ( 2012-05-07 19:09:57 -0500 )edit

plus two points for other users who might be interested. First, the @reboot command need to be keyed in via crontab -e rather than sudo crontab -e; Secondly, using !/bin/bash rather !/bin/sh inside the shell script, or else commands like source won't work

clark gravatar image clark  ( 2012-05-07 19:36:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-05-07 16:01:48 -0500

Seen: 1,241 times

Last updated: May 07 '12