You were close dnmorgan, but using `/bin/sh` as `sh` isn't an alias, it is using the PATH to find an executable without requiring the user to supply the full path.
The issue in this case is that instead of supplying a path he's supplying a command. The trigger.run may already be assuming it is a script, but it won't immediately start in the downloads folder just because it was mapped. The path should be `/home/vagrant/Downloads/launch-cassandra.sh`. On Tuesday, September 29, 2020 at 8:32:34 AM UTC-5 [email protected] wrote: > So the shell command you are using e.g. sh is a convenience alias (usually > located and sourced in/from your .bashrc file) when you are actually logged > into a machine (called interactive mode/shell). Typically when you are > running a script in this fashion you are using a non-interactive shell > meaning the convenience aliases are not available to you (.bashrc file is > not sourced). As a result you would need to explicitly target the shell > command directly like /usr/bin/sh or /bin/bash etc. > > On Sunday, September 27, 2020 at 12:25:31 PM UTC-4 [email protected] > wrote: > >> How to execute a script containing multiple command on guest machine >> >> NOTE: i have already defined in my Vagrant File as >> >> *config.vm.synced_folder ".", "/home/vagrant/Downloads/"* >> >> As per website, i have added below line into providers section of >> VagrantFile which i need to execute once the guestOS is up and running as: >> >> config.vm.provider "virtualbox" do |vb| >> >> vb.memory = "2048" >> >> vb.name = "Cassandra-4.0-Vagrant" >> >> config.trigger.after :up do |trigger| >> >> trigger.name = "execute script" >> >> trigger.info = "running multiple commands within the script" >> >> trigger.run = {path: "sh launch-cassandra.sh" } >> >> end >> >> end >> >> *Now Output i am receiving is :* >> >> There are errors in the configuration of this machine. Please fix >> >> the following errors and try again: >> >> >> trigger: >> >> * `path` for shell provisioner does not exist on the host system: >> >> >> Also since this file which i am trying to execute on Guest OS, exists in >> the Download section with the path as /home/vagrant/Downloads *(which i >> have already mentioned in the start), after login into guest os using >> vagrant ssh command and executing directly , it is running successfully.* >> >> >> *Kindly provide me the solution to execute this scripts while executing >> command vagrant reload* >> >> >> >> >> >> -- 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/hashicorp/vagrant/issues Discuss: https://discuss.hashicorp.com/c/vagrant/24 --- 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/8ffad481-989f-402c-aaeb-4044078bb6efn%40googlegroups.com.
