Skip to content

Instantly share code, notes, and snippets.

@ihower
Created January 22, 2013 05:35
Show Gist options
  • Save ihower/4592370 to your computer and use it in GitHub Desktop.
Save ihower/4592370 to your computer and use it in GitHub Desktop.
#!/bin/sh
### BEGIN INIT INFO
# Provides: redis
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts redis database system
# Description: starts redis using basic start scripts
### END INIT INFO
PATH=/opt/redis:/sbin:/bin:/usr/sbin:/usr/bin
NAME=redis
test -x $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --user redis -c redis:redis \
--startas /opt/redis/redis-server -- /opt/redis/redis.conf
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --exec /opt/redis/redis-server -c redis:redis \
/opt/redis/redis-server -- /opt/redis/redis.conf
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment