pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail Check that the required_files do exist before sta...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/511450723664
branches:  trunk
changeset: 469485:511450723664
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Feb 24 01:18:52 2004 +0000

description:
Check that the required_files do exist before starting the process.  If
start_cmd is defined, then rc.subr skips the required_files check, so do it
ourselves within the start_cmd.

diffstat:

 mail/courier-imap/files/courierimap.sh  |  18 +++++++++++++++---
 mail/courier-imap/files/courierimaps.sh |  18 +++++++++++++++---
 mail/courier-imap/files/courierpop.sh   |  18 +++++++++++++++---
 mail/courier-imap/files/courierpops.sh  |  18 +++++++++++++++---
 mail/sqwebmail/files/pcpd.sh            |  18 +++++++++++++++---
 mail/sqwebmail/files/sqwebmaild.sh      |  19 ++++++++++++++++---
 6 files changed, 91 insertions(+), 18 deletions(-)

diffs (212 lines):

diff -r 785cc7e8de2e -r 511450723664 mail/courier-imap/files/courierimap.sh
--- a/mail/courier-imap/files/courierimap.sh    Tue Feb 24 01:10:31 2004 +0000
+++ b/mail/courier-imap/files/courierimap.sh    Tue Feb 24 01:18:52 2004 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: courierimap.sh,v 1.7 2004/02/22 03:13:07 jlam Exp $
+# $NetBSD: courierimap.sh,v 1.8 2004/02/24 01:18:52 jlam Exp $
 #
 # Courier IMAP services daemon
 #
@@ -25,8 +25,20 @@
 {
        action=$1
        case ${action} in
-       start)  @ECHO@ "Starting ${name}." ;;
-       stop)   @ECHO@ "Stopping ${name}." ;;
+       start)
+               for f in $required_files; do
+                       if [ ! -r "$f" ]; then
+                               @ECHO@ "$0: WARNING: $f is not readable"
+                               if [ -z $rc_force ]; then
+                                       return 1
+                               fi
+                       fi
+               done
+               @ECHO@ "Starting ${name}."
+               ;;
+       stop)
+               @ECHO@ "Stopping ${name}."
+               ;;
        esac
 
        ${ctl_command} ${action}
diff -r 785cc7e8de2e -r 511450723664 mail/courier-imap/files/courierimaps.sh
--- a/mail/courier-imap/files/courierimaps.sh   Tue Feb 24 01:10:31 2004 +0000
+++ b/mail/courier-imap/files/courierimaps.sh   Tue Feb 24 01:18:52 2004 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: courierimaps.sh,v 1.7 2004/02/22 03:13:07 jlam Exp $
+# $NetBSD: courierimaps.sh,v 1.8 2004/02/24 01:18:52 jlam Exp $
 #
 # Courier IMAP/SSL services daemon
 #
@@ -26,8 +26,20 @@
 {
        action=$1
        case ${action} in
-       start)  @ECHO@ "Starting ${name}." ;;
-       stop)   @ECHO@ "Stopping ${name}." ;;
+       start)
+               for f in $required_files; do
+                       if [ ! -r "$f" ]; then
+                               @ECHO@ "$0: WARNING: $f is not readable"
+                               if [ -z $rc_force ]; then
+                                       return 1
+                               fi
+                       fi
+               done
+               @ECHO@ "Starting ${name}."
+               ;;
+       stop)
+               @ECHO@ "Stopping ${name}."
+               ;;
        esac
 
        ${ctl_command} ${action}
diff -r 785cc7e8de2e -r 511450723664 mail/courier-imap/files/courierpop.sh
--- a/mail/courier-imap/files/courierpop.sh     Tue Feb 24 01:10:31 2004 +0000
+++ b/mail/courier-imap/files/courierpop.sh     Tue Feb 24 01:18:52 2004 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: courierpop.sh,v 1.7 2004/02/22 03:13:07 jlam Exp $
+# $NetBSD: courierpop.sh,v 1.8 2004/02/24 01:18:52 jlam Exp $
 #
 # Courier POP services daemon
 #
@@ -25,8 +25,20 @@
 {
        action=$1
        case ${action} in
-       start)  @ECHO@ "Starting ${name}." ;;
-       stop)   @ECHO@ "Stopping ${name}." ;;
+       start)
+               for f in $required_files; do
+                       if [ ! -r "$f" ]; then
+                               @ECHO@ "$0: WARNING: $f is not readable"
+                               if [ -z $rc_force ]; then
+                                       return 1
+                               fi
+                       fi
+               done
+               @ECHO@ "Starting ${name}."
+               ;;
+       stop)
+               @ECHO@ "Stopping ${name}."
+               ;;
        esac
 
        ${ctl_command} ${action}
diff -r 785cc7e8de2e -r 511450723664 mail/courier-imap/files/courierpops.sh
--- a/mail/courier-imap/files/courierpops.sh    Tue Feb 24 01:10:31 2004 +0000
+++ b/mail/courier-imap/files/courierpops.sh    Tue Feb 24 01:18:52 2004 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: courierpops.sh,v 1.7 2004/02/22 03:13:07 jlam Exp $
+# $NetBSD: courierpops.sh,v 1.8 2004/02/24 01:18:52 jlam Exp $
 #
 # Courier POP3/SSL services daemon
 #
@@ -26,8 +26,20 @@
 {
        action=$1
        case ${action} in
-       start)  @ECHO@ "Starting ${name}." ;;
-       stop)   @ECHO@ "Stopping ${name}." ;;
+       start)
+               for f in $required_files; do
+                       if [ ! -r "$f" ]; then
+                               @ECHO@ "$0: WARNING: $f is not readable"
+                               if [ -z $rc_force ]; then
+                                       return 1
+                               fi
+                       fi
+               done
+               @ECHO@ "Starting ${name}."
+               ;;
+       stop)
+               @ECHO@ "Stopping ${name}."
+               ;;
        esac
 
        ${ctl_command} ${action}
diff -r 785cc7e8de2e -r 511450723664 mail/sqwebmail/files/pcpd.sh
--- a/mail/sqwebmail/files/pcpd.sh      Tue Feb 24 01:10:31 2004 +0000
+++ b/mail/sqwebmail/files/pcpd.sh      Tue Feb 24 01:18:52 2004 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: pcpd.sh,v 1.1 2004/02/23 23:41:43 jlam Exp $
+# $NetBSD: pcpd.sh,v 1.2 2004/02/24 01:18:52 jlam Exp $
 #
 # Courier SqWebMail calendaring services daemon
 #
@@ -23,8 +23,20 @@
 {
        action=$1
        case ${action} in
-       start)  @ECHO@ "Starting ${name}." ;;
-       stop)   @ECHO@ "Stopping ${name}." ;;
+       start)
+               for f in $required_files; do
+                       if [ ! -r "$f" ]; then
+                               @ECHO@ "$0: WARNING: $f is not readable"
+                               if [ -z $rc_force ]; then
+                                       return 1
+                               fi
+                       fi
+               done
+               @ECHO@ "Starting ${name}."
+               ;;
+       stop)
+               @ECHO@ "Stopping ${name}."
+               ;;
        esac
 
        ${command} ${action}
diff -r 785cc7e8de2e -r 511450723664 mail/sqwebmail/files/sqwebmaild.sh
--- a/mail/sqwebmail/files/sqwebmaild.sh        Tue Feb 24 01:10:31 2004 +0000
+++ b/mail/sqwebmail/files/sqwebmaild.sh        Tue Feb 24 01:18:52 2004 +0000
@@ -1,6 +1,6 @@
 #!@RCD_SCRIPTS_SHELL@
 #
-# $NetBSD: sqwebmaild.sh,v 1.1 2004/02/23 23:41:43 jlam Exp $
+# $NetBSD: sqwebmaild.sh,v 1.2 2004/02/24 01:18:52 jlam Exp $
 #
 # Courier SqWebMail services daemon
 #
@@ -14,6 +14,7 @@
 name="sqwebmaild"
 rcvar=${name}
 command="@PREFIX@/libexec/courier/sqwebmail/sqwebmaild"
+pidfile="@SQWEBMAIL_STATEDIR@/sqwebmail.sock.pid"
 required_files="@PKG_SYSCONFDIR@/authmodulelist"
 
 start_cmd="courier_doit start"
@@ -23,8 +24,20 @@
 {
        action=$1
        case ${action} in
-       start)  @ECHO@ "Starting ${name}." ;;
-       stop)   @ECHO@ "Stopping ${name}." ;;
+       start)
+               for f in $required_files; do
+                       if [ ! -r "$f" ]; then
+                               @ECHO@ "$0: WARNING: $f is not readable"
+                               if [ -z $rc_force ]; then
+                                       return 1
+                               fi
+                       fi
+               done
+               @ECHO@ "Starting ${name}."
+               ;;
+       stop)
+               @ECHO@ "Stopping ${name}."
+               ;;
        esac
 
        ${command} ${action}



Home | Main Index | Thread Index | Old Index