patch-src_etc_script_sympa_in 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. $OpenBSD: patch-src_etc_script_sympa_in,v 1.4 2016/11/04 10:22:26 landry Exp $
  2. --- src/etc/script/sympa.in.orig Wed Jun 10 18:24:26 2015
  3. +++ src/etc/script/sympa.in Thu Nov 3 17:10:49 2016
  4. @@ -90,7 +51,7 @@ sympa_status() {
  5. if [ -f ${sympapiddir}/$1.pid ] ; then
  6. pid=`head -1 ${sympapiddir}/$1.pid | tr -s ' ' '|'`
  7. if [ "$pid" != "" ] ; then
  8. - running=`ps -A | egrep "$pid"`
  9. + running=`pgrep -f $1.pl`
  10. if [ "$running" != "" ]; then
  11. echo "$1 (pid(s) $pid) is active..."
  12. return 0
  13. @@ -188,7 +137,7 @@ sympa_stop() {
  14. if [ "$pids" != "" ]; then
  15. for pid in $pids; do
  16. killcount=0
  17. - running=`ps -A | grep "$pid ..* $comm"`
  18. + running=`pgrep -f $1.pl`
  19. while [ "$running" != "" ]; do
  20. if [ $killcount -gt 10 ]; then
  21. if [ ${use_functions} ]; then
  22. @@ -200,13 +149,13 @@ sympa_stop() {
  23. fi
  24. kill -TERM $pid >/dev/null 2>&1
  25. - running=`ps -A | grep "$pid ..* $comm"`
  26. + running=`pgrep -f $1.pl`
  27. if [ "$running" = "" ]; then
  28. runcount=`expr $runcount + 1`
  29. break
  30. fi
  31. sleep 2
  32. - running=`ps -A | grep "$pid ..* $comm"`
  33. + running=`pgrep -f $1.pl`
  34. if [ "$running" = "" ]; then
  35. runcount=`expr $runcount + 1`
  36. break
  37. @@ -232,14 +176,6 @@ sympa_stop() {
  38. }
  39. -# Check that networking is up.
  40. -if [ ${OSTYPE} != "Slack" -a ${OSTYPE} != "FreeBSD" -a ${OSTYPE} != "SunOS" -a ${OSTYPE} != "darwin7.0" -a ${OSTYPE} != "Debian" -a ${OSTYPE} != "Suse" ]; then
  41. - if [ ${NETWORKING} = "no" ]
  42. - then
  43. - exit 0
  44. - fi
  45. -fi
  46. -
  47. # Check config files
  48. [ -d $sympadir ] || exit 0
  49. [ -f $sympaconf ] || exit 0
  50. @@ -297,11 +233,13 @@ case "$1" in
  51. else
  52. echo "Status file for subsystem NOT found."
  53. fi
  54. - sympa_status sympa_msg
  55. - sympa_status bulk
  56. - sympa_status archived
  57. - sympa_status bounced
  58. - sympa_status task_manager
  59. + failed=0
  60. + sympa_status sympa_msg || failed=1
  61. + sympa_status bulk || failed=1
  62. + sympa_status archived || failed=1
  63. + sympa_status bounced || failed=1
  64. + sympa_status task_manager || failed=1
  65. + if [ $failed == 1 ] ; then exit 1 ; fi
  66. ;;
  67. restart)
  68. echo "Restarting Sympa subsystem: "