ubuntu mate 16.04设置开机自启动,运行ros程序
ubuntu mate 16.04设置开机自启动,运行ros程序
1.home文件目录下建立start_node.sh文件
文件内容
#!/bin/sh
### BEGIN INIT INFO
# Provides: start_node.sh
# Required-start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the svnd.sh daemon
# Description: starts svnd.sh using start-stop-daemon
### END INIT INFOmate-terminal --window -x bash -c "source ~/xxx/devel/setup.bash; roscore; exec bash "
sleep 10
mate-terminal --window -x bash -c "source ~/xxx/devel/setup.bash; roslaunch x x.launch; exec bash "
sleep 10exec bash
2.System->ControlCenter->Personal->StartupApplications添加启动项,命令选择start_node.sh
3.重启
---------------------------------------
上述方法有个问题,必须要等待第一个终端关闭后才会执行下一个终端
解决办法:
终端中运行脚本会同时执行两个命令
所以修改start_node.sh
为
#!/bin/sh
### BEGIN INIT INFO
# Provides: start_node.sh
# Required-start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the svnd.sh daemon
# Description: starts svnd.sh using start-stop-daemon
### END INIT INFOsleep 20
mate-terminal --window -x bash -c "bash test.sh; exec bash "
exec bash
新建test.sh脚本
内容为
#!/bin/sh
### BEGIN INIT INFO
# Provides: start_node.sh
# Required-start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the svnd.sh daemon
# Description: starts svnd.sh using start-stop-daemon
### END INIT INFOmate-terminal --window -x bash -c "source ~/xxx/devel/setup.bash; roscore; exec bash "
sleep 10
mate-terminal --window -x bash -c "source ~/xxx/devel/setup.bash; roslaunch x x.launch; exec bash " exec bash
----------------------------------------
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
