-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadredis.sh
More file actions
executable file
·66 lines (57 loc) · 777 Bytes
/
loadredis.sh
File metadata and controls
executable file
·66 lines (57 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
REDIS_HOME="$HOME/local/redis"
REDIS_PIDFILE="$REDIS_HOME/var/redis.pid"
function start()
{
if [ -f $REDIS_PIDFILE ]
then
stop
else
$REDIS_HOME/bin/redis-server $REDIS_HOME/conf/redis.conf
fi
if [ $? -eq 0 ]
then
echo "start redis success."
else
echo "start redis failed."
fi
return $?
}
function stop()
{
if [ -f $REDIS_PIDFILE ]
then
kill $(cat $REDIS_PIDFILE)
fi
if [ $? -eq 0 ]
then
echo "stop redis success."
else
echo "stop redis failed."
fi
return $?
}
function restart()
{
stop
start
if [ $? -eq 0 ]
then
echo "restart redis success."
else
echo "restart redis failed."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac