privileged (boolean) - 指定是否执行 shell 脚本是否为特权用户 (sudo).默认情况下这是真".您将希望使用 vagrant 用户运行脚本,以便您可以更改为config.vm.provision "shell", 内联: "/vagrant/scripts/install.sh", 特权: false然后您应该使用 nohup 在会话停止后保持脚本运行nohup/opt/weblogic/user_projects/domains/custom/startWeblogic.sh &>/home/vagrant/startWeblogic.out&nohup/opt/weblogic/user_proejcts/domains/custom/bin/startNodeManager &>/home/vagrant/startNodeManager.out&In Vagrant, I run an inline script that starts up Weblogic and NodeManager/opt/weblogic/user_projects/domains/custom/startWeblogic.sh &/opt/weblogic/user_proejcts/domains/custom/bin/startNodeManager &ps -ef shows that both processes are running when running the inline script. But if I were to ssh in the guest machine and run ps -ef, neither processes are to be found. Is there a way to keep the processes running after the inline script? 解决方案 Currently you running the script but its executed as root user so all the lines are added for this user only. You want to use the privileged option privileged (boolean) - Specifies whether to execute the shell script as a privileged user or not (sudo). By default this is "true".you will want to run the script with the vagrant user so you can change toconfig.vm.provision "shell", inline: "/vagrant/scripts/install.sh", privileged: falseYou should then use nohup to keep the script running after the session is stoppednohup /opt/weblogic/user_projects/domains/custom/startWeblogic.sh &> /home/vagrant/startWeblogic.out&nohup /opt/weblogic/user_proejcts/domains/custom/bin/startNodeManager &> /home/vagrant/startNodeManager.out& 这篇关于通过 Vagrant 完成内联脚本后进程停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-27 08:44