#! /bin/bash
is_number()
{
echo "$1" | awk '$0 ~/[^0-9]/ { print "NA" }'>/tmp/numcheck$$$
if [ "`cat /tmp/numcheck$$$|xargs`" == NA ] ;then
echo "NA"
fi
}
check_empty()
{
if [ "$1" == "" ] ;then
echo "Blank input please try again !!!!!!!!!!!"
exit
else
private=": ; = root passwd user `ls |xargs`"
check=`echo $private |grep -w $1 |xargs`
if [ "$check" != "" ] ;then
echo "Reserved Word Please Retry :$private "
exit
fi
fi
}
install_redis()
{
echo -e "\033[1m Redis server install Require sudoers user \033[0m"
echo "Checking if redis already installed"
sleep 3
if [ -f "/usr/local/bin/redis-server" ] ; then
echo "Redis installation already exits skipping source compile"
if [ -f "/usr/bin/redis-server" ] ; then
echo "Redis installation already exits skipping source compile"
fi
else
cd ~/
if [ -f "~/redis-2.2.14.tar.gz" ] ;then
mv ~/redis-2.2.14* ~/redis-2.2.14_`date +%Y-%m-%d`
fi
wget http://redis.googlecode.com/files/redis-2.2.14.tar.gz
tar xzf redis-2.2.14.tar.gz
cd redis-2.2.14/ && make && sudo make install && mkdir -p ~/redis && sudo cp utils/redis_init_script /etc/init.d/Restart_Redis && cp redis.conf ~/redis/redis.conf && cd - && echo -e "\033[1m Enter the Redis port for custom application \033[0m"
read port_input
if [ "$port_input" == "" ] ; then
echo "No redis port Specified continuing with default :recommends manual setting after Setup"
port_check="`is_number $port_input |xargs`"
if [ "$port_check" == "NA" ] ;then
echo "invalid redis port Specified continuing with default :recommends manual setting after Setup"
else
echo "HELLO GOOD $port_input"
fi
fi
fi
}
yes_no()
{
if [ "$*" != "yes" ] ; then
echo "Thanks please try again ...."
exit 1
fi
}
install_redis
No comments:
Post a Comment