I have a script that surely will take a long time to execute. I have a multi-machine installation. On boot (preferably) I would like to have the script running on every one of the machines. However, I would like to do this asynchronously.
Alteatively I could execute vagrant ssh for each machine.
In the first case I add in the Vagrant file:
Vagrant.configure("2") do |config|
config.vm.provision "shell", run: "always", inline: 'bash /home/vagrant/shared_folder/script.sh &'
...
Yet, although I can see a process running on each guest, it is not executed.
For the second case:
vagrant ssh client5 -c "/home/vagrant/shared_folder/script.sh & sleep 1"
The sleep 1 is a "hack" suggested on another post. Yet, it runs only once and then exits.
The contents of the script are:
while [ true ];
do
rand=`shuf -i 10-200 -n 1`
curl "192.168.56.10/pages/"$rand"K.html"
sleep 5
done
When I execute the script from inside the guest everything runs perfectly.
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 255
تاريخ: چهارشنبه
16 تير
1395 ساعت: 21:27