[one-users] Run bash script in vm on spin-up

Valentin Bud valentin.bud at gmail.com
Mon Sep 8 23:27:18 PDT 2014


Hello Kerry,

Do you have a registered image of type CONTEXT with the name of `test.sh`
in the files datastore?

The file you specify in FILES_DS can be found in the contextualization CDROM
on the VM (/dev/disk/by-label/CONTEXT).

The following would run a `test.sh` script when the VM is spun up at the end
of the contextualization routine [1].

CONTEXT = [
  FILES_DS="$FILE[IMAGE=\"test.sh\"]",
  INIT_SCRIPTS="test.sh",
  ...
]

[1]:
https://github.com/OpenNebula/addon-context-linux/blob/master/base/etc/one-context.d/99-execute-scripts

Best,
Valentin


On Mon, Sep 8, 2014 at 11:09 PM, kerryhall . <kerryhall at gmail.com> wrote:

> Thanks! I'm still having issues here unfortunately. I tried putting:
>
> FILES_DS="$FILE[IMAGE=\"test.sh\"]"
>
> into my template context section, but I get:
>
> "User 0 does not own an image with name: test.sh"
>
> I'm not trying to include an image, I just want test.sh (a file in my file
> datastore) to get copied to anywhere on my vm's filesystem. (And
> eventually, I want test.sh to get run on vm creation, or failing that,
> every time the vm starts)
>
> Thanks!!
>
> On Fri, Jul 25, 2014 at 11:18 PM, Valentin Bud <valentin.bud at gmail.com>
> wrote:
>
>> Hello Kerry,
>>
>> Under "Defining Context" [1] there is an example how to use FILES_DS.
>>
>> FILES_DS="$FILE[IMAGE=\"test.sh\"]
>>
>> [1]: http://docs.opennebula.org/4.6/user/virtual_machine_setup/cong.html
>>
>> Best,
>> Valentin
>>
>>
>>
>> On Fri, Jul 25, 2014 at 11:29 PM, kerryhall . <kerryhall at gmail.com>
>> wrote:
>>
>>> Hi folks,
>>>
>>> I am trying to run a bash script on a vm as it gets spun up. I've read:
>>> http://docs.opennebula.org/4.6/user/virtual_machine_setup/cong.html
>>>
>>> but there isn't too much to go on there.
>>>
>>> I have created "test.sh" and put it into the "files" datastore on the
>>> head node.
>>>
>>> The issue I am having is that the syntax in the "Defining Context"
>>> section of
>>> http://docs.opennebula.org/4.6/user/virtual_machine_setup/cong.html is
>>> ambiguous, specifically the "files_ds" section. I have tried:
>>>
>>> FILES_DS="$FILE[\"test.sh\"]"
>>>
>>> and
>>> FILES_DS="/var/lib/one/datastores/2/test.sh"
>>>
>>> As a first step, I'm just trying to get this file included in my vm at
>>> all.
>>>
>>> Thanks!
>>> Kerry
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20140909/296ce1af/attachment.htm>


More information about the Users mailing list