diff options
author | Eivind Uggedal <eivind@uggedal.com> | 2014-05-26 08:30:07 +0000 |
---|---|---|
committer | Eivind Uggedal <eivind@uggedal.com> | 2014-05-26 08:30:07 +0000 |
commit | ed6d1c1ce955f87dd6f8ddb95012b928a24646dd (patch) | |
tree | f69a56b9ec40f69b66d459ce676202176cb63c6b /main/redis/redis.initd | |
parent | d260b8a120a6cc6d2e251741d65fd8605b4cb361 (diff) | |
download | aports-ed6d1c1ce955f87dd6f8ddb95012b928a24646dd.tar.bz2 aports-ed6d1c1ce955f87dd6f8ddb95012b928a24646dd.tar.xz |
main/redis: moved from testing
Diffstat (limited to 'main/redis/redis.initd')
-rwxr-xr-x | main/redis/redis.initd | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/main/redis/redis.initd b/main/redis/redis.initd new file mode 100755 index 0000000000..f6c2ce617a --- /dev/null +++ b/main/redis/redis.initd @@ -0,0 +1,52 @@ +#!/sbin/runscript + +REDIS_CONF=${REDIS_CONF:-/etc/redis.conf} +REDIS_USER=${REDIS_USER:-redis} +REDIS_GROUP=${REDIS_GROUP:-redis} + +name="Redis server" +command=/usr/bin/redis-server +command_args=${REDIS_CONF} + +depend() { + use net localmount logger + after keepalived firewall +} + +# get global pidfile, logfile, and dir from config file +get_config() { + if [ ! -f "${REDIS_CONF}" ] ; then + eerror "You need a ${REDIS_CONF} file to run redis" + return 1; + fi + + pidfile=$(awk '$1 == "pidfile" { print $2 }' "$REDIS_CONF") + logfile=$(awk '$1 == "logfile" { print $2 }' "$REDIS_CONF") + dir=$(awk '$1 == "dir" { print $2 }' "$REDIS_CONF") + : ${pidfile:=/var/run/redis/redis.pid} + : ${logfile:=/var/log/redis/redis.log} + : ${dir:=/var/lib/redis} +} + +start() { + get_config || return 1 + checkpath -d -o ${REDIS_USER}:${REDIS_GROUP} ${pidfile%/*} \ + ${logfile%/*} ${dir} + + ebegin "Starting $name" + start-stop-daemon --start \ + --chdir "${dir}" \ + --user ${REDIS_USER}:${REDIS_GROUP} \ + --pidfile "${pidfile}" \ + --exec "${command}" \ + -- ${command_args} + eend $? +} + +stop() { + get_config + ebegin "Stopping $name" + start-stop-daemon --stop --retry 30 --pidfile "${pidfile}" + eend $? +} + |