在目录 ~/Library/LaunchAgents 下新建redis.plist文件
[codesyntax lang=”xml”]
<?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>Label</key> <string>com.redis</string> <key>RunAtLoad</key> <true/> <key>ProgramArguments</key> <array> <string>/usr/local/bin/redis-server</string> <string>/usr/local/etc/redis.conf</string> </array> </dict> </plist>
[/codesyntax]
launchctl load ~/Library/LaunchAgents/redis.plist
launchctl start com.redis
同理,memcached,nginx都这么随机启动