mac os x 把reids nignx mongodb做成随机启动吧
~/Library/LaunchAgents 由用户自己定义的任务项 /Library/LaunchAgents 由管理员为用户定义的任务项 /Library/LaunchDaemons 由管理员定义的守护进程任务项 /System/Library/LaunchAgents 由Mac OS X为用户定义的任务项 /System/Library/LaunchDaemons 由Mac OS X定义的守护进程任务项
大部分安装完都会有一个plist,下面以nginx为例:
1.把plist拷到/Library/LaunchDaemons
sudo cp /usr/local/opt/nginx/*.plist /Library/LaunchDaemons
2.【可选】修改plist参数或增加其他(增加日志文件存放位置等)
3.修改权限
sudo chown root:wheel /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
4.启动
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
sudo launchctl start homebrew.mxcl.nginx
参考:
http://stepquick.net/blog/2014/04/28/start-nginx-at-launch-on-mavericks/
https://alicoding.com/how-to-start-mongodb-automatically-when-starting-your-mac-os-x/