#!/sbin/runscript # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header pidfile="/var/run/srsd.pid" command="/usr/bin/srsd" command_args="${SRSD_OPTS}" depend() { use logger } checkconfig() { if [[ ! -z ${SRSD_SECRET_FILE} ]]; then if [[ ! -f ${SRSD_SECRET_FILE} ]]; then eerror "Secret file \"${SRSD_SECRET_FILE}\" does not exist. Please create it." return 1 fi if [[ $(stat --printf '%s\n' ${SRSD_SECRET_FILE}) -eq 0 ]]; then eerror "Secret file \"${SRSD_SECRET_FILE}\" must NOT be empty." return 1 fi fi return 0 } start() { checkconfig || return 1 ebegin 'Starting SRS daemon' start-stop-daemon \ --start \ --background \ --pidfile ${pidfile} \ --make-pidfile \ --exec ${command} \ -- ${command_args} eend $? } stop() { ebegin 'Stopping SRS daemon' start-stop-daemon \ --stop \ --pidfile ${pidfile} \ --exec ${command} eend $? }