[英]How can I automatically do vagrant up every time my OSX machine boots?
I need a way to automatically do a vagrant up
command inside my directory /Users/user/Dropbox/Development/Homestead 我需要一种方法在我的目录/ Users / user / Dropbox / Development / Homestead中自动执行vagrant up
命令
Does anyone know how this can be achieved? 有谁知道如何实现这一目标?
You can write an automator application (ie workflow) and in that application have it run the shell script with your desired vagrant command. 您可以编写一个automator应用程序(即工作流程),并在该应用程序中使用您所需的vagrant命令运行shell脚本。 Then go to System Preferences -> Accounts -> Login items and add that application as a login item. 然后转到系统偏好设置 - >帐户 - >登录项目,并将该应用程序添加为登录项目。
With a LaunchD item. 使用LaunchD项目。 Put a file containing this in your /Library/LaunchDaemons directory: 将包含此文件的文件放在/ Library / LaunchDaemons目录中:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UserName</key>
<string>user</string>
<key>Label</key>
<string>org.xyzzy.vagrantsrc</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/vagrant</string>
<string>up</string>
</array>
<key>RunAtLoad</key><true/>
<key>UserName</key><string>jenkins</string>
<key>WorkingDirectory</key><string>/Users/user/Dropbox/Development/Homestead</string>
</dict>
</plist>
It needs to be owned by root and called something.plist 它需要由root拥有并调用something.plist
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.