Mac 开机启动redis和mongodb

1.mongodb开机启动,新建一个plist文件

 

<?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>io.mongo.mongo</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/mongod</string>
        <string>-f</string>
        <string>/Users/walle/Documents/mongoConfig/mongodb.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

注意配置文件的目录替换成你自己的配置目录

 

2. 安装个LaunchRocket

可以用命令也行,launchctl load YOUR_PATH/NAME_OF_REDIS.plist

用这种launchrocket方便些,点add.plist,然后 勾选At Login即可

 

3.Redis开机启动,plist

 

<?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>io.redis.redis-server</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/redis-server</string>
        <string>/Users/walle/Documents/redisConfig/redis.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

 

同样处理即可

 

http://www.waitingfy.com/archives/3495

3495

Leave a Reply

Name and Email Address are required fields.
Your email will not be published or shared with third parties.