packages/utils/smstools3/files/smstools3.init
Harald Geyer 0cc76f89ae smstools3: Move init script to use procd
* properly install config file
* prevent smsd from starting right after installation to prevent loss of data
  (make default device unavailable by turning configuration into comments)
* move init script to procd
* update init script priority to sane value
* log to syslog - at the moment via stdout and procd
  this is a workaround to force smsd to stay in the foreground
* the init script can't do a modem reset anymore
  use an alarmhandler script instead
* add a local patch to make all processes terminate if the main process dies
* take over the package as new maintainer

Signed-off-by: Harald Geyer <harald@ccbib.org>
2018-03-06 14:17:14 +00:00

37 lines
780 B
Bash

#!/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
}