redis Windows平台启动脚本

本文介绍了一种简化Redis启动过程的方法。通过编写一个批处理脚本来自动定位Redis安装目录并启动Redis服务,避免了手动启动的繁琐步骤。该脚本会检查环境变量REDIS_HOME是否已设置,并验证必要的配置文件是否存在。

我所下载的redis[http://blog.youkuaiyun.com/yueaini10000/article/details/72761092]是没有启动文件,每次启动都需要自己手动进入根目录,然后在运行文件
颇为麻烦
于是就萌生了写一个脚本的想法,然后就按照Tomcat的启动脚本为蓝本写了一个redis的启动脚本

@echo off
rem by:czh60601@126.com

setlocal

rem Guess REDIS_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%REDIS_HOME%" == "" goto gotHome
set "REDIS_HOME=%CURRENT_DIR%"
set "REDIS_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%REDIS_HOME%\redis-server.exe" goto okHome
echo The REDIS_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:okHome
rem Check redis.windows.conf exists
if exist "%REDIS_HOME%\redis.windows.conf" goto okExec
echo Cannot find "%REDIS_HOME%\redis.windows.conf"
echo This file is needed to run this program
goto end
:okExec

start redis-server.exe redis.windows.conf

:end
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Grey Sun

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值