title: How to properly use runcmd and scripts-user in cloud-init?
body: <p>By looking at <em>runcmd</em> code (/usr/lib/python2.6/site-packages/cloudinit/config/cc_runcmd.py)
  I noticed there's no 'frequency' specified in comparison to other. Beside the only thing that scripts does is to save the scripts given as shells script under /var/lib/cloud/instance/scripts/runcmd .</p>
  
  <p>So if I verbosely specify the modules, I MUST set the frequency.</p>
  
  <pre><code>cloud_config_modules:
   - mounts
   - locale
   - set-passwords
   - timezone
   - [ runcmd, always ]
  
  cloud_final_modules:
   - scripts-per-once
   - scripts-per-boot
   - scripts-per-instance
   - [ scripts-user, always ]
   - ssh-authkey-fingerprints
  </code></pre>
  
  <p>and the scripts created by this particular can be run by 'scripts-user', so I need to specify i.e.</p>
  
  <pre><code>- [ scripts-user, always ]
  </code></pre>
  
  <p>to make runcmd scripts working</p>
  
  <p>Is it proper way to do so ? The documentation (at least current 0.7.7) lacks proper explanation of runcmd and user-scripts and how they can be utilized</p>
  
  <p>I also don't understand difference between all the mode, once (first time the instance boot), instance(???), always ( that I understand), ????boot(that one exist? it doesn't seem to work...</p>
  
  <p>EDIT:</p>
  
  <p>ok, i have found in cloudinit/settings.py:</p>
  
  <pre><code># Valid frequencies of handlers/modules
  PER_INSTANCE = "once-per-instance"
  PER_ALWAYS = "always"
  PER_ONCE = "once"
  </code></pre>
  
  <p>and beside I found an explanation in this script:</p>
  
  <pre><code>[root@euca-10-254-97-216 ~]# cloud-init-per -h
  Usage: cloud-init-per frequency name cmd [ arg1 [ arg2 [ ... ] ]
     run cmd with arguments provided.
  
     This utility can make it easier to use boothooks or bootcmd
     on a per "once" or "always" basis.
  
     If frequency is:
        * once: run only once (do not re-run for new instance-id)
        * instance: run only the first boot for a given instance-id
        * always: run every boot
  </code></pre>
  
  <p>But I don't catch the difference between 'once' and 'instance'. So if the same image (rather snapshot) with new instance id in the case 'once' it won't start ? in case 'instance' it will ?</p>