aboutsummaryrefslogtreecommitdiffstats
path: root/main/sems/sems.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-05-02 06:21:32 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-05-02 06:21:32 +0000
commit0c7345a551feec6fc5b1e156612ab43382734cf7 (patch)
tree1f709a513a1a13a0e77d49a7d765a0a83d179167 /main/sems/sems.initd
parentdf747d4c71238ae72b98ae3e46fd64098a049836 (diff)
downloadaports-0c7345a551feec6fc5b1e156612ab43382734cf7.tar.bz2
aports-0c7345a551feec6fc5b1e156612ab43382734cf7.tar.xz
main/sems: upgrade to 1.4.0 (moved from testing)
Diffstat (limited to 'main/sems/sems.initd')
-rwxr-xr-x[-rw-r--r--]main/sems/sems.initd51
1 files changed, 31 insertions, 20 deletions
diff --git a/main/sems/sems.initd b/main/sems/sems.initd
index 0e96f8a21a..3b6973b55c 100644..100755
--- a/main/sems/sems.initd
+++ b/main/sems/sems.initd
@@ -3,35 +3,46 @@
# Follows Gentoo/AlpineLinux standards
# GPL 2 License - N. Angelacos 2011
-CONFDIR="/etc/sems"
SVC="${SVCNAME#*.}"
-if [ -n "${SVC}" ] && [ "${SVCNAME}" != "sems" ]; then
- SEMSPID="/var/run/sems/${SVC}.pid"
- else
- SEMSPID="/var/run/sems/sems.pid"
- fi
-SEMSCONF="${CONFDIR}/${SVC}.conf"
-daemon=/usr/sbin/sems
+SEMS_CFG_FILE=${SEMS_CFG_FILE:-/etc/sems/${SVC}.conf}
+SEMS_PIDDIR=/var/run/sems
+SEMS_PIDFILE=${SEMS_PIDFILE:-${SEMS_PIDDIR}/${SVC}.pid}
+SEMS_BINARY=${SEMS_BINARY:-/usr/sbin/sems}
+SEMS_USER=${SEMS_USER:-sems}
+SEMS_GROUP=${SEMS_GROUP:-sems}
-depend() {
- need net
- after firewall
+checkconfig() {
+ if [ ! -f "${SEMS_CFG_FILE}" ] ; then
+ eerror "You need a "${SEMS_CFG_FILE}" file to run sems"
+ return 1;
+ fi
}
+
start() {
- ebegin "Starting ${SVCNAME}"
- echo $SEMSPID $SEMSCONF
- start-stop-daemon --start --quiet --pidfile $SEMSPID --exec $daemon \
+ checkconfig || return 1
+ ebegin "Starting ${SVCNAME}"
+ mkdir -p "${SEMS_PIDDIR}"
+ chown ${SEMS_USER}:${SEMS_GROUP} "${SEMS_PIDDIR}"
+
+ start-stop-daemon --start --exec "${SEMS_BINARY}" \
+ --pidfile "${SEMS_PIDFILE}" \
+ --wait ${SEMS_WAIT:-500} \
-- \
- -u sems \
- -g sems \
- -P $SEMSPID \
- -f $SEMSCONF
+ -f "${SEMS_CFG_FILE}" \
+ -P "${SEMS_PIDFILE}" \
+ -u "${SEMS_USER}" \
+ -g "${SEMS_GROUP}"
eend $?
}
stop() {
- ebegin "Stopping ${SVCNAME}"
- start-stop-daemon --stop --quiet --pidfile $SEMSPID
+ if [ "${RC_CMD}" = "restart" ] ; then
+ checkconfig || return 1
+ fi
+
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --exec "${SEMS_BINARY}" \
+ --pidfile "${SEMS_PIDFILE}" --quiet
eend $?
}