# Cloud-config run commands on startup

**URL:** <https://forums.suse.com/t/cloud-config-run-commands-on-startup/2971>\
**Category:** RancherOS\
**Created:** [May 31, 2016, 9:31am UTC](https://forums.suse.com/t/cloud-config-run-commands-on-startup/2971 "2016-05-31T09:31:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raboo](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/raboo/32/1381_2.png) [@Raboo](https://forums.suse.com/u/Raboo)\
**Post date:** [May 31, 2016, 9:31am UTC](https://forums.suse.com/t/cloud-config-run-commands-on-startup/2971/1 "2016-05-31T09:31:45Z")

</div>

Is there a file that will execute before user-docker?  
I’ve seen examples like this

```
#cloud-config
write_files:
  - path: /opt/rancher/bin/start.sh
    permissions: "0755"
    owner: root
    content: |
      #!/bin/bash
      echo "I'm doing things on start" > /opt/start-sh-did-this

```

But there is no /opt/rancher/bin/ folder. So is this outdated information? What place have this file moved to?

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [June 16, 2016, 6:43pm UTC](https://forums.suse.com/t/cloud-config-run-commands-on-startup/2971/2 "2016-06-16T18:43:15Z")

</div>

`/opt/bin/rancher` will be created when your particular cloud config file is executed.

Currently all custom commands are run at the same time, which is at the start of the console container. User Docker is started around the same time as the console, so I wouldn’t count on scripts happening either before or after it.

In the future our aim is to implement the cloud config `runcmd` and `bootcmd` fields. `runcmd` will be executed at the same time as commands are now, and `bootcmd` will happen sometime earlier in the boot process.

---

<div class="post-metadata">

**Author:** ![saphoooo](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/saphoooo/32/1431_2.png) [@saphoooo](https://forums.suse.com/u/saphoooo)\
**Post date:** [June 16, 2016, 9:07pm UTC](https://forums.suse.com/t/cloud-config-run-commands-on-startup/2971/3 "2016-06-16T21:07:36Z")

</div>

It works with /etc/rc.local

````auto
  - path: /etc/rc.local
    permissions: "0755"
    owner: root
    content: |
      #!/bin/bash
      crond
```
````
