redis restart in linux code example
Example 1: restart redis ubuntu
# restart redis service
sudo service redis-server restart
# stop redis service
sudo service redis-server stop
Example 2: script for 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