#!/sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-mobilephone/smstools/files/smsd.initd3,v 1.1 2012/12/20 10:41:42 chainsaw Exp $

depend() {
	need localmount
}

start() {
	if ! [ -d /var/run/smsd ]; then
		ebegin "Creating /var/run/smsd for ${SVCNAME}"
		mkdir /var/run/smsd \
			&& chown smsd:smsd /var/run/smsd \
			&& chmod 770 /var/run/smsd
		eend $?
	fi

	ebegin "Starting smsd"
	start-stop-daemon -b -u smsd:smsd --start --exec /usr/sbin/smsd -- \
		-c /etc/smsd.conf -p /var/run/smsd/smsd.pid \
		-i /var/run/smsd/smsd.working
	eend ${?}
}

stop() {
	ebegin "Stopping smsd"
	start-stop-daemon --stop -n smsd
	eend ${?}
}
