Service redis restart

Option 1:

brew services start|run redis 
brew services stop redis
brew services restart redis

Option 2: Script to restart Redis service automatically

#!/bin/bash
a=$(redis-cli -p 6379 PING)
if [ "$a" = "PONG" ]
then
    echo 'Already running'
else
    b=$(/etc/init.d/redis_6379 start)   
    echo $b
fi