Browse Source

%status and pidfile handling

master
Michael van Elst 23 years ago committed by Ralf S. Engelschall
parent
commit
2a9ffe2697
  1. 2
      postfix-mailgraph/postfix-mailgraph.spec
  2. 25
      postfix-mailgraph/rc.postfix-mailgraph

2
postfix-mailgraph/postfix-mailgraph.spec

@ -33,7 +33,7 @@ Distribution: OpenPKG [EVAL]
Group: Mail
License: GPL
Version: 1.4
Release: 20030719
Release: 20030721
# list of sources
Source0: http://people.ee.ethz.ch/~dws/software/mailgraph/pub/mailgraph-%{version}.tar.gz

25
postfix-mailgraph/rc.postfix-mailgraph

@ -6,14 +6,33 @@
%config
postfix_mailgraph_enable="$openpkg_rc_def"
%common
postfix_mailgraph_pidfile="@l_prefix@/var/postfix-mailgraph/run/mailgraph.pid"
postfix_mailgraph_signal () {
[ -f $postfix_mailgraph_pidfile ] \
&& kill -$1 `cat $postfix_mailgraph_pidfile`
}
%status -p 200 -u @l_susr@ -o
postfix_mailgraph_usable="unknown"
postfix_mailgraph_active="no"
rcService postfix_mailgraph enable yes && \
postfix_mailgraph_signal 0 && postfix_mailgraph_active="yes"
echo "postfix_mailgraph_enable=\"$postfix_mailgraph_enable\""
echo "postfix_mailgraph_usable=\"$postfix_mailgraph_usable\""
echo "postfix_mailgraph_active=\"$postfix_mailgraph_active\""
%start -p 100 -u @l_susr@
rcService postfix_mailgraph enable yes || exit 0
@l_prefix@/sbin/mailgraph --daemon
%stop -p 200 -u @l_susr@
rcService postfix_mailgraph enable yes || exit 0
if [ -f @l_prefix@/var/postfix-mailgraph/run/mailgraph.pid ]; then
kill -TERM `cat @l_prefix@/var/postfix-mailgraph/run/mailgraph.pid` >/dev/null 2>&1 || true
postfix_mailgraph_signal TERM
%restart -p 200 -u @l_susr@
rcService postfix_mailgraph enable yes || exit 0
postfix_mailgraph_signal TERM
sleep 2
fi
@l_prefix@/sbin/mailgraph --daemon

Loading…
Cancel
Save