> For the complete documentation index, see [llms.txt](https://idminer.gitbook.io/robotis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idminer.gitbook.io/robotis/part-3.-robotis-op3-ren-xing-ji-qi-ren/3.-kai-shi-shang-shou/3.2.-ru-he-sha-diao-demo-cheng-shi/3.2.2.-zai-qi-dong-shi-zhi-hang-demo/3.2.2.1.-zai-qi-dong-shi-jiu-zhi-hang-demo-cheng-shi.md).

# 3.2.2.1. 在啟動時就執行 demo 程式

1\. 要製作自動運行的腳本，新開一個終端視窗並執行以下指令。 （密碼：111111）

```
$ rosrun robot_upstart install --job JOB_NAME --user root --master http://10.42.0.1 op3_demo/launch/demo.launch
```

* JOB\_NAME：此項是要指定自動運行的 job 名稱。Job 名稱將會在 service 上註冊。**例如：OP3-demo**

```
rosrun robot_upstart install --job OP3-demo --user root --master http://10.42.0.1:11311 op3_demo/launch/demo.launch
```

{% hint style="info" %}
**注意**：將會根據 **op3\_demo/launch/demo.launch** 來生成自動運行程式。
{% endhint %}

2\. 修改腳本&#x20;

* 打開 service 服務文件並修改內容

```
$ sudo xed /usr/sbin/OP3-demo-start
```

* from : **export ROS\_HOSTNAME=$(hostname)**&#x20;
* to : **export ROS\_HOSTNAME=10.42.0.1**

3\. 運行 service 服務文件

```
$  sudo systemctl daemon-reload && sudo systemctl start JOB_NAME
```

* **daemontools** 需安裝：如果系統上未安裝 **daemontools**，請執行以下命令。

```
$ sudo apt install daemontools
```
