#!/bin/sh /etc/rc.common
# Copyright (C) 2014-2018 OpenWrt.org

START=94

USE_PROCD=1

# If an unpriviledged user is selected, make sure that next two
# files are writable by that user:
PIDFILE="/var/run/smsd.pid"
INFOFILE="/var/run/smsd.working"

DAEMON=/usr/bin/smsd

# Set/edit this before starting service !!!!!
WRT_SPOOL=/var/spool

start_service() {
	echo "Creating minimum spool directories"
	mkdir -p $WRT_SPOOL
	mkdir -p $WRT_SPOOL/sms
	mkdir -p $WRT_SPOOL/sms/incoming
	mkdir -p $WRT_SPOOL/sms/outgoing
	mkdir -p $WRT_SPOOL/sms/checked
	mkdir -p $WRT_SPOOL/sms/failed
	mkdir -p $WRT_SPOOL/sms/sent

	procd_open_instance

	procd_set_param command $DAEMON -n MAINPROCESS -p$PIDFILE -i$INFOFILE
	procd_set_param respawn
	procd_set_param stdout 1

	procd_close_instance
}


