mail/sympa: fix bugs in rc.d script

* Current sympa.rc not show the correct status, always active. grep
  with pid string also process.
* The output of ps depends on the windows size. Sometime truncated
  /usr/local/libexec/sympa/task_manager.pl -w for avoid it.
* Change ps options to BSD-sytle.

PR:		199145
Submitted by:	Igor Zabelin <igorz@yandex.ru>
Approved by:	geoffroy desvernay <dgeo@centrale-marseille.fr> (maintainer)
This commit is contained in:
Jan Beich 2015-05-03 07:33:40 +00:00
parent 605fcdb8ac
commit 46e782c273
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=385235
2 changed files with 5 additions and 4 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= sympa
PORTVERSION= 6.1.24
PORTREVISION= 1
CATEGORIES= mail
MASTER_SITES= http://www.sympa.org/distribution/ \
http://www.sympa.org/distribution/old/

View file

@ -51,7 +51,7 @@ sub_status()
if [ -f /var/run/sympa/$1.pid ] ; then
pid=`head -1 /var/run/sympa/$1.pid | tr -s ' ' '|'`
if [ "$pid" != "" ] ; then
running=`ps -A | egrep "$pid"`
running=`ps -axw | grep "^[[:space:]]*$pid[[:space:]]"`
if [ "$running" != "" ]; then
echo "$1 (pid(s) $pid) is active..."
return 0
@ -115,7 +115,7 @@ sub_stop()
if [ "$pids" != "" ]; then
for pid in $pids; do
killcount=0
running=`ps -A | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
running=`ps -axw | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
while [ "$running" != "" ]; do
if [ $killcount -gt 10 ]; then
echo 'failure'
@ -123,13 +123,13 @@ sub_stop()
fi
kill -TERM $pid >/dev/null 2>&1
running=`ps -A | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
running=`ps -axw | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
if [ "$running" = "" ]; then
runcount=`expr $runcount + 1`
break
fi
sleep 2
running=`ps -A | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
running=`ps -axw | grep "^[[:space:]]*$pid[[:space:]].*$1\\.pl"`
if [ "$running" = "" ]; then
runcount=`expr $runcount + 1`
break