Thanks. I got it working. The issue was I need to use the path
/vagrant on all files I was trying to access. Your message gave me the
hints I needed to figure this out.

On Mon, Jul 10, 2017 at 6:27 PM, Alvaro Miranda Aguilera
<[email protected]> wrote:
> hello
>
> if you can share what you have done, ie github project I can help
>
> scripts, and Vagrantfile will make all easier.
>
> run: "always" make the script to run each time vagrant up even after the
> first time.
>
> imagine you have an script that does this.
>
> pwd
> id
> echo $EUID
>
> it will run and show the user and current directory
>
> the way the script is created is copy the file to a random location, set the
> executable bit and run it
>
> if you run
>
> vagrant ssh -c 'sudo /vagrant/<script.sh>' should be the same when vagrant
> run it.
>
> if you require local path, then your script should do that for you
>
>
> #!/usr/bin/env bash
>
> pwd
>
> pushd /vagrant
> pwd
> #here what you need
> popd
>
>
> is one way to do it
>
>
>
> On Mon, Jul 10, 2017 at 12:10 PM, Larry Martell <[email protected]>
> wrote:
>>
>> Thanks for the reply. I want to run on 'vargrant up' I realized I
>> needed to add :run => 'always' to make that happen. Now it's running
>> but I am still having issues.
>>
>> The script creates a file with a here doc but the file does not get
>> created. There is no error on that, but no file. If I run the script
>> by hand the file is created. I have checked and it's not a permission
>> issue.
>>
>> The second issue I have is that I am trying to access a file in a
>> subdir, and I get "No such file or directory" even though the path to
>> the file does exist and is accessible.
>>
>>
>> On Mon, Jul 10, 2017 at 2:13 PM, Alvaro Miranda Aguilera
>> <[email protected]> wrote:
>> > hello
>> >
>> > as long in the same level where your Vagrantfile is, vagrant will copy
>> > setup.sh, set the execute flag and run it.
>> >
>> > inside the VM you can do
>> >
>> > cd /vagrant
>> > sudo ./setup.sh and should have the same effect.
>> >
>> >
>> >
>> > On Fri, Jul 7, 2017 at 2:49 PM, Larry Martell <[email protected]>
>> > wrote:
>> >>
>> >> I have a directory that sometimes is used in a native environment on
>> >> bare
>> >> metal and other times used in a VM started with vagrant up. The only
>> >> difference is a few config files. What is the accepted way of getting
>> >> the VM
>> >> version of the config files in place when a vagrant up is run?
>> >>
>> >> I tried running a setup.sh script that uses here docs and sed, but it
>> >> seems like the script does not run. I have this line in my Vagrantfile:
>> >>
>> >> web.vm.provision :shell, :path => "setup.sh"

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CACwCsY6cEh7Ve1mB8XxPfStGFs5f2Lv34%2B0%3DJG69VtcE5aDY6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to