mac redis自启动,启动,launchctl list |grep redis

 

1,将redis的启动文件放到shell脚本中执行

sudo vi redis-launchd.sh

#! /bin/sh

#! 备注,把redis安装目录里的 redis-server 和 redis.conf 分别复制到  bin 和 etc 目录,如果没有目录 则新建

/usr/local/redis-4.0.14/bin/redis-server /usr/local/redis-4.0.14/etc/redis.conf

sudo chmod +x redis-launchd.sh

sudo vi /Library/LaunchDaemons/icom.redis.plist

 




    Label  com.redis
    RunAtLoad         
    KeepAlive         
    ProgramArguments
        
            /usr/local/redis-4.0.14/bin/redis-launchd.sh
        
    RunAtLoad         
    KeepAlive         
    WorkingDirectory  /usr/local/redis-4.0.14

 

sudo launchctl load /Library/LaunchDaemons/com.redis.plist

sudo chown root /Library/LaunchDaemons/com.redis.plist

sudo launchctl start com.redis

重启电脑;

sudo launchctl list |grep redis

你可能感兴趣的:(mac,redis)