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 saurav...@gmail.com 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 vagrant-up+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c07ee918-489e-41f8-b72c-3ef00e5cecf0n%40googlegroups.com.