mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-11-04 02:11:39 +01:00 
			
		
		
		
	- avoid building linenoise at install time - set loglevel to 'notice' by default - set default log and pidfiles in redis subdir with permissions - create redis user at pre-install - fix init.d script to read pid, log and dir from redis.conf - remove unnneded vars from conf.d
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
		
			Executable File
		
	
	
	
	
#!/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_post() {
 | 
						|
	get_config
 | 
						|
	ebegin "Stopping $name"
 | 
						|
	start-stop-daemon --stop --quiet --pidfile "${pidfile}" \
 | 
						|
		&& rm -f "${pidfile}"
 | 
						|
	eend $?
 | 
						|
}
 | 
						|
 |