Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
322ad086
Commit
322ad086
authored
Jun 14, 2011
by
antirez
Browse files
Better init script
parent
b90c72c8
Changes
1
Show whitespace changes
Inline
Side-by-side
utils/redis_init_script
View file @
322ad086
#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REDISPORT
=
6379
EXEC
=
/usr/local/bin/redis-server
CLIEXEC
=
/usr/local/bin/redis-cli
PIDFILE
=
/var/run/redis_
${
REDISPORT
}
.pid
CONF
=
"/etc/redis/
${
REDISPORT
}
.conf"
...
...
@@ -10,20 +14,20 @@ case "$1" in
start
)
if
[
-f
$PIDFILE
]
then
echo
-n
"
$PIDFILE
exists, process is already running or crashed
\n
"
echo
"
$PIDFILE
exists, process is already running or crashed"
else
echo
-n
"Starting Redis server...
\n
"
echo
"Starting Redis server..."
$EXEC
$CONF
fi
;;
stop
)
if
[
!
-f
$PIDFILE
]
then
echo
-n
"
$PIDFILE
does not exist, process is not running
\n
"
echo
"
$PIDFILE
does not exist, process is not running"
else
PID
=
$(
cat
$PIDFILE
)
echo
-n
"Stopping ...
\n
"
echo
-n
"SHUTDOWN
\r\n
"
| nc localhost
$REDISPORT
&
echo
"Stopping ..."
$CLIEXEC
-p
$REDISPORT
shutdown
while
[
-x
/proc/
${
PIDFILE
}
]
do
echo
"Waiting for Redis to shutdown ..."
...
...
@@ -32,4 +36,7 @@ case "$1" in
echo
"Redis stopped"
fi
;;
*
)
echo
"Please use start or stop as first argument"
;;
esac
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment