[csw-devel] SF.net SVN: gar:[9392] csw/mgar/pkg/imapproxy/trunk
chninkel at users.sourceforge.net
chninkel at users.sourceforge.net
Sat Mar 27 00:42:28 CET 2010
Revision: 9392
http://gar.svn.sourceforge.net/gar/?rev=9392&view=rev
Author: chninkel
Date: 2010-03-26 23:42:28 +0000 (Fri, 26 Mar 2010)
Log Message:
-----------
imapproxy: switched to cswclassutils for SMF and conf handling
Modified Paths:
--------------
csw/mgar/pkg/imapproxy/trunk/Makefile
csw/mgar/pkg/imapproxy/trunk/checksums
Added Paths:
-----------
csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy
Removed Paths:
-------------
csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.depend
csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.gspec
csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy.init
csw/mgar/pkg/imapproxy/trunk/files/i.init
csw/mgar/pkg/imapproxy/trunk/files/i.smf
csw/mgar/pkg/imapproxy/trunk/files/r.init
csw/mgar/pkg/imapproxy/trunk/files/r.smf
csw/mgar/pkg/imapproxy/trunk/files/svc-cswimapproxy
Modified: csw/mgar/pkg/imapproxy/trunk/Makefile
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/Makefile 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/Makefile 2010-03-26 23:42:28 UTC (rev 9392)
@@ -30,10 +30,8 @@
RUNTIME_DEP_PKGS = CSWtcpwrap
RUNTIME_DEP_PKGS += CSWosslrt
-# adding configuration handling classes
SPKG_CLASSES = none cswpreserveconf cswinitsmf
-
###### Upstream and opencsw files information #######
MASTER_SITES = http://www.imapproxy.org/downloads/
@@ -45,10 +43,13 @@
DISTFILES += imapproxy.conf
DISTFILES += changelog.CSW README.CSW
# init and smf stuffs
-DISTFILES += cswimapproxy.init cswimapproxy.xml
+DISTFILES += cswimapproxy cswimapproxy.xml
DISTNAME = up-$(GARNAME)-$(GARVERSION)
+INITSMF = /etc/init.d/cswimapproxy
+PRESERVECONF = /opt/csw/etc/imapproxy.conf
+
# imapproxy lacks include of openssl/md5.h
# PATCHFILES += md5_include.patch
@@ -78,6 +79,7 @@
ginstall -D $(WORKSRC_FIRSTMOD)/README.ssl $(PKGROOT)$(docdir)/$(GARNAME)/README.ssl
ginstall -D $(WORKDIR_FIRSTMOD)/imapproxy.conf $(PKGROOT)$(sysconfdir)/imapproxy.conf.CSW
ginstall -D "$(WORKDIR_FIRSTMOD)/cswimapproxy.xml" "$(PKGROOT)/var/opt/csw/svc/manifest/network/cswimapproxy.xml"
+ ginstall -D "$(WORKDIR_FIRSTMOD)/cswimapproxy" "$(PKGROOT)/etc/init.d/cswimapproxy"
@$(MAKECOOKIE)
Modified: csw/mgar/pkg/imapproxy/trunk/checksums
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/checksums 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/checksums 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,8 +1,7 @@
-d185afd650ebb8c7dac35fdf54b8f319 CSWimapproxy.prototype
05c9327816e6c24ba9fe253c6e76c71a README.CSW
f7a91b2816c12035ab08f355a1d44881 changelog.CSW
c70c04af058e01012ef1beb8caaeb296 conf_file_location.patch
-645dbf4681fba2e3430b4bdfb28cb540 cswimapproxy.init
+645dbf4681fba2e3430b4bdfb28cb540 cswimapproxy
2d586e6018bd82b6ac4c49b75ff837ad cswimapproxy.xml
497ca80cf7e1ccbb4caac0319533a17e destdir.patch
5d51df28803c859277b7f6c3b68acf9e imapproxy.conf
Deleted: csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.depend
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.depend 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.depend 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,2 +0,0 @@
-P CSWosslrt openssl_rt - Openssl runtime libraries
-P CSWtcpwrap tcpwrappers
Deleted: csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.gspec
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.gspec 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/CSWimapproxy.gspec 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,11 +0,0 @@
-%var bitname imapproxy
-%var pkgname CSWimapproxy
-%include url file://%{PKGLIB}/csw_dyndepend.gspec
-%copyright url file://%{WORKSRC}/COPYING
-%var RC_INIT_SCRIPT cswimapproxy.init
-%var INIT_KILL_PRIO 99
-%var INIT_START_PRIO 10
-%var CAN_BE_AUTOENABLED no
-%var SERVICE_CONF_FILES /opt/csw/etc/imapproxy.conf
-%var SERVICE_NAME imapproxy
-%include url file://%{PKGLIB}/smf_enabled.gspec
Copied: csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy (from rev 9389, csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy.init)
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy (rev 0)
+++ csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy 2010-03-26 23:42:28 UTC (rev 9392)
@@ -0,0 +1,103 @@
+#!/bin/sh
+# /etc/init.d/imapproxy
+#
+
+#RC_KNUM 99
+#RC_SNUM 10
+#RC_KLEV 0,1,2,S
+#RC_SLEV 3
+#MANIFEST /var/opt/csw/svc/manifest/network/cswimapproxy.xml
+#AUTOENABLE no
+
+
+################################
+# Variable initialization #
+################################
+PROGNAME=in.imapproxyd
+BINPATH=/opt/csw/sbin
+INIT_FILE=/etc/init.d/cswimapproxy
+CONF_DIR=/opt/csw/etc
+CONF_FILE=$CONF_DIR/imapproxy.conf
+OPTIONS=""
+
+
+####################
+# Useful functions #
+####################
+
+start()
+{
+ if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
+ /usr/bin/echo "$PROGNAME is already running."
+ else
+ /usr/bin/echo "Starting $PROGNAME: \c"
+ # imapproxy can be stuck if some case.
+ # For example if it can't resolve the imap server name at startup
+ # it will not fork and will retry to resolve the name (for a long time)
+ # so we launch it in background, we wait and then we test if
+ # the process has not died
+ $BINPATH/$PROGNAME -f $CONF_FILE &
+ sleep 1
+ # if the fork occured the backgrounded process shouldn't
+ # exist anymore
+ if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
+ /usr/bin/echo "OK."
+ else
+ /usr/bin/echo "Failed."
+ fi
+ fi
+}
+
+
+stop()
+{
+ if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
+ /usr/bin/echo "Stopping $PROGNAME: \c"
+ pkill -15 -f "^$BINPATH/$PROGNAME -f $CONF_FILE$"
+ /usr/bin/echo "OK."
+ else
+ /usr/bin/echo "$PROGNAME is not running."
+ fi
+}
+
+
+restart()
+{
+ stop
+ start
+}
+
+
+status()
+{
+
+ pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null
+ RET=$?
+
+ if [ "$RET" -eq 0 ]; then
+ /usr/bin/echo "$PROGNAME is running."
+ else
+ /usr/bin/echo "$PROGNAME is not running."
+ fi
+
+ return $RET
+}
+
+
+[ -x ${BINPATH}/${PROGNAME} ] || exit 5
+
+# We don't do anything if configuration file
+# is not present
+[ -f "$CONF_FILE" ] || exit 0
+
+case "$1" in
+ start) start ;;
+ stop) stop ;;
+ restart) restart ;;
+ reload) reload ;;
+ status) status ;;
+ *)
+ /usr/bin/echo "Usage: $INIT_FILE {start|stop|restart|reload|status}"
+ exit 1
+ ;;
+esac
Deleted: csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy.init
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy.init 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/cswimapproxy.init 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,99 +0,0 @@
-#!/bin/sh
-# /etc/init.d/imapproxy
-#
-
-# chkconfig stuff
-# chkconfig: 3 99 10
-# description: A caching IMAP proxy server
-
-################################
-# Variable initialization #
-################################
-PROGNAME=in.imapproxyd
-BINPATH=/opt/csw/sbin
-INIT_FILE=/etc/init.d/cswimapproxy
-CONF_DIR=/opt/csw/etc
-CONF_FILE=$CONF_DIR/imapproxy.conf
-OPTIONS=""
-
-
-####################
-# Useful functions #
-####################
-
-start()
-{
- if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
- /usr/bin/echo "$PROGNAME is already running."
- else
- /usr/bin/echo "Starting $PROGNAME: \c"
- # imapproxy can be stuck if some case.
- # For example if it can't resolve the imap server name at startup
- # it will not fork and will retry to resolve the name (for a long time)
- # so we launch it in background, we wait and then we test if
- # the process has not died
- $BINPATH/$PROGNAME -f $CONF_FILE &
- sleep 1
- # if the fork occured the backgrounded process shouldn't
- # exist anymore
- if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
- /usr/bin/echo "OK."
- else
- /usr/bin/echo "Failed."
- fi
- fi
-}
-
-
-stop()
-{
- if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
- /usr/bin/echo "Stopping $PROGNAME: \c"
- pkill -15 -f "^$BINPATH/$PROGNAME -f $CONF_FILE$"
- /usr/bin/echo "OK."
- else
- /usr/bin/echo "$PROGNAME is not running."
- fi
-}
-
-
-restart()
-{
- stop
- start
-}
-
-
-status()
-{
-
- pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null
- RET=$?
-
- if [ "$RET" -eq 0 ]; then
- /usr/bin/echo "$PROGNAME is running."
- else
- /usr/bin/echo "$PROGNAME is not running."
- fi
-
- return $RET
-}
-
-
-[ -x ${BINPATH}/${PROGNAME} ] || exit 5
-
-# We don't do anything if configuration file
-# is not present
-[ -f "$CONF_FILE" ] || exit 0
-
-case "$1" in
- start) start ;;
- stop) stop ;;
- restart) restart ;;
- reload) reload ;;
- status) status ;;
- *)
- /usr/bin/echo "Usage: $INIT_FILE {start|stop|restart|reload|status}"
- exit 1
- ;;
-esac
Deleted: csw/mgar/pkg/imapproxy/trunk/files/i.init
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/i.init 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/i.init 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,88 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at blastwave.org>
-# All rights reserved. Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted. This code is without warranty of any kind. The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-# i.init - class script which install init.d script and runlevels
-# symlinks
-#
-umask 0022
-LANG=C
-export LANG
-
-read_conf_value ()
-{
- _VAR="$1"
- _FILE="$2"
- eval ${_VAR}=\"`/usr/bin/sed -n -e "/^# *$_VAR:/ s/^.*$_VAR: *\(.*[^ ]\) *$/\1/p" ${_FILE}`\"
-}
-
-
-# retrieve the state of a service
-load_init_info ()
-{
- _INIT_FILE="$1"
- _INIT_INFO=""
- if [ -f "$INIT_INFO_FILE" ]; then
- INIT_INFO="`awk \" \\\$1 == \\\"$_INIT_FILE\\\" { print \\\$2,\\\$3,\\\$4,\\\$5,\\\$6,\\\$7,\\\$8,\\\$9,\\\$10,\\\$11,\\\$12,\\\$13,\\\$14,\\\$15,\\\$16,\\\$17 }\" "$INIT_INFO_FILE"`"
- return 0
- fi
- if [ -z "$INIT_INFO" ]; then
- # No previous init info saved, we find the init info
- # from the chkconfig info in the init file
- read_conf_value chkconfig "$SRC"
- set -- $chkconfig
-
- RUNLEVEL="$1"
- START_PRIORITY_LEVEL="$2"
- STOP_PRIORITY_LEVEL="$3"
-
- for LEVEL in 0 1 2 3 S; do
- if echo "${RUNLEVEL}" | grep "${LEVEL}" >/dev/null; then
- # if service was started in level 2, we do not need
- # to create the start link in level 3
- [ "${LEVEL}" = "3" ] && echo "${RUNLEVEL}" | grep "2" >/dev/null
- if [ $? -ne 0 ]; then
- INIT_INFO="$INIT_INFO $LEVEL S$START_PRIORITY_LEVEL"
- fi
- else
- INIT_INFO="$INIT_INFO $LEVEL K$STOP_PRIORITY_LEVEL"
- fi
- done
- fi
-}
-
-
-restore_runlevel_symlinks ()
-{
- _INIT_FILE="$1"
- _INIT_INFO="$2"
- _SERVICE_NAME="`basename \"$_INIT_FILE\"`"
- while [ -n "$_INIT_INFO" ]; do
- read _LEVEL _PRIORITY _INIT_INFO <<EOF
-$_INIT_INFO
-EOF
- _LEVELDIR="/etc/rc${_LEVEL}.d"
- if [ ! -f "$_LEVELDIR/${_PRIORITY}${_SERVICE_NAME}" ]; then
- ln -s "${_INIT_FILE}" "$_LEVELDIR/${_PRIORITY}${_SERVICE_NAME}"
- fi
- done
-}
-
-INIT_INFO_FILE="$PKG_INSTALL_ROOT/tmp/$PKG.initinfo"
-
-while read SRC DEST; do
- SERVICENAME=`/usr/bin/basename $DEST`
-
- cp "$SRC" "$DEST"
- chown root:sys "$DEST"
- chmod 740 "$DEST"
-
- load_init_info "$DEST"
- restore_runlevel_symlinks "$DEST" "$INIT_INFO"
-
-done
Deleted: csw/mgar/pkg/imapproxy/trunk/files/i.smf
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/i.smf 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/i.smf 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,38 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at blastwave.org>
-# All rights reserved. Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted. This code is without warranty of any kind. The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-# i.smf - class script which install smf related files
-# This class will simply copy file except for the
-# manifest file which, in addition, will imported
-# in the svc repository
-#
-# use this class for the following files:
-# /opt/csw/var/svc
-# /opt/csw/var/svc/manifest
-# /opt/csw/var/svc/manifest/network
-# /opt/csw/var/svc/manifest/network/softname.xml=/softname.xml
-# /opt/csw/lib/svc
-# /opt/csw/lib/svc/method
-# /opt/csw/lib/svc/method/svc-softname
-#
-if [ -z "$PKG_INSTALL_ROOT" ]; then
- PKG_INSTALL_ROOT="/"
-fi
-
-while read SRC DEST; do
- EXT="`/usr/bin/echo $DEST | /usr/bin/awk -F. '{ print $(NF) }'`"
- "$BASEDIR/usr/bin/cp" "$SRC" "$DEST" || exit 2
- # the .xml file is the manifest file
- if [ "$EXT" = "xml" ]; then
- chroot "$PKG_INSTALL_ROOT" /usr/sbin/svccfg import "$DEST"
- fi
-done
-
-exit 0
-
Deleted: csw/mgar/pkg/imapproxy/trunk/files/r.init
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/r.init 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/r.init 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,93 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at blastwave.org>
-# All rights reserved. Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted. This code is without warranty of any kind. The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-# r.init - class script which remove init.d script and runlevels
-# symlinks and save symlinks modification if any
-#
-umask 0022
-LANG=C
-export LANG
-
-
-read_conf_value ()
-{
- _VAR="$1"
- _FILE="$2"
- eval ${_VAR}=\"`/usr/bin/sed -n -e "/^# *$_VAR:/ s/^.*$_VAR: *\(.*[^ ]\) *$/\1/p" ${_FILE}`\"
-}
-
-
-read_init_info ()
-{
- _INIT_FILE="$1"
- # we just search for all files referencing the init scripts
- _INUM=`ls -i "$_INIT_FILE" | /usr/bin/awk '{ print $1 }'`
- /usr/bin/find /etc/rc[S0-6].d -follow -inum "$_INUM" | while read _RCLINK; do
- _LEVEL=`echo $_RCLINK | cut -b8`
- _PRIORITY=`echo $_RCLINK | cut -b12-14`
- printf "$_LEVEL $_PRIORITY "
- done
- printf "\n"
-}
-
-# save the state of a service
-save_init_info ()
-{
- _INIT_FILE="$1"
- _INIT_INFO_FILE="$2"
-
- _DEFAULT_INIT_INFO=""
- _INIT_INFO=""
-
- # we read chkconfig init info to check if runlevels symlinks
- # have been changed from the default setup
- read_conf_value chkconfig "$_INIT_FILE"
- set -- $chkconfig
-
- RUNLEVEL="$1"
- START_PRIORITY_LEVEL="$2"
- STOP_PRIORITY_LEVEL="$3"
-
- for _LEVEL in 0 1 2 3 S; do
- if echo "${RUNLEVEL}" | grep "${_LEVEL}" >/dev/null; then
- _DEFAULT_INIT_INFO="$_DEFAULT_INIT_INFO $_LEVEL S$START_PRIORITY_LEVEL"
- else
- _DEFAULT_INIT_INFO="$_DEFAULT_INIT_INFO $_LEVEL K$START_PRIORITY_LEVEL"
- fi
- done
-
- _INIT_INFO="`read_init_info \"$_INIT_FILE\"`"
-
- if [ " $_INIT_INFO" != "$_DEFAULT_INIT_INFO " ]; then
- echo "$_INIT_FILE $_INIT_INFO" >> "$_INIT_INFO_FILE"
- fi
-}
-
-# delete all runlevels symlinks for the given init script
-delete_runlevel_symlinks ()
-{
- _INIT_FILE="$1"
-
- _INUM=`ls -i "$_INIT_FILE" | /usr/bin/awk '{ print $1 }'`
- /usr/bin/find /etc/rc[S0-6].d -follow -inum "$_INUM" -exec rm '{}' ';'
-}
-
-INIT_INFO_FILE="${PKG_INSTALL_ROOT}/tmp/$PKG.initinfo"
-rm -f "$INIT_INFO_FILE"
-
-while read DEST; do
- if [ -z "$DEST" ]; then
- continue
- fi
-
- save_init_info "$DEST" "$INIT_INFO_FILE"
- delete_runlevel_symlinks "$DEST"
-
- rm "$DEST"
-done
Deleted: csw/mgar/pkg/imapproxy/trunk/files/r.smf
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/r.smf 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/r.smf 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,38 +0,0 @@
-#
-# Copyright 2006 Yann Rouillard <yann at blastwave.org>
-# All rights reserved. Use is subject to license terms.
-#
-# Redistribution and/or use, with or without modification, is
-# permitted. This code is without warranty of any kind. The
-# author(s) shall not be liable in the event that use of the
-# software causes damage.
-#
-# r.smf - class script which removes smf related files
-#
-# use this class for the following files:
-# /opt/csw/var/svc
-# /opt/csw/var/svc/manifest
-# /opt/csw/var/svc/manifest/network
-# /opt/csw/var/svc/manifest/network/softname.xml=/softname.xml
-# /opt/csw/lib/svc
-# /opt/csw/lib/svc/method
-# /opt/csw/lib/svc/method/svc-softname
-
-if [ -z "$PKG_INSTALL_ROOT" ]; then
- PKG_INSTALL_ROOT="/"
-fi
-
-while read DEST; do
- EXT="`/usr/bin/echo $DEST | /usr/bin/awk -F. '{ print $(NF) }'`"
- if [ "$EXT" = "xml" ]; then
- for FRMI in `chroot "$PKG_INSTALL_ROOT" /usr/sbin/svccfg inventory "$DEST"`; do
- chroot "$PKG_INSTALL_ROOT" /usr/sbin/svccfg delete "$FRMI" >/dev/null 2>&1
- done
- fi
- if [ ! -d "$DEST" ]; then
- "$BASEDIR/usr/bin/rm" "$DEST" || exit 2
- fi
-done
-
-exit 0
-
Deleted: csw/mgar/pkg/imapproxy/trunk/files/svc-cswimapproxy
===================================================================
--- csw/mgar/pkg/imapproxy/trunk/files/svc-cswimapproxy 2010-03-26 22:56:02 UTC (rev 9391)
+++ csw/mgar/pkg/imapproxy/trunk/files/svc-cswimapproxy 2010-03-26 23:42:28 UTC (rev 9392)
@@ -1,99 +0,0 @@
-#!/bin/sh
-# /etc/init.d/imapproxy
-#
-
-# chkconfig stuff
-# chkconfig: 3 99 10
-# description: A caching IMAP proxy server
-
-################################
-# Variable initialization #
-################################
-PROGNAME=in.imapproxyd
-BINPATH=/opt/csw/sbin
-INIT_FILE=/etc/init.d/cswimapproxy
-CONF_DIR=/opt/csw/etc
-CONF_FILE=$CONF_DIR/imapproxy.conf
-OPTIONS=""
-
-
-####################
-# Useful functions #
-####################
-
-start()
-{
- if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
- /usr/bin/echo "$PROGNAME is already running."
- else
- /usr/bin/echo "Starting $PROGNAME: \c"
- # imapproxy can be stuck if some case.
- # For example if it can't resolve the imap server name at startup
- # it will not fork and will retry to resolve the name (for a long time)
- # so we launch it in background, we wait and then we test if
- # the process has not died
- $BINPATH/$PROGNAME -f $CONF_FILE &
- sleep 1
- # if the fork occured the backgrounded process shouldn't
- # exist anymore
- if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
- /usr/bin/echo "OK."
- else
- /usr/bin/echo "Failed."
- fi
- fi
-}
-
-
-stop()
-{
- if pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null; then
- /usr/bin/echo "Stopping $PROGNAME: \c"
- pkill -15 -f "^$BINPATH/$PROGNAME -f $CONF_FILE$"
- /usr/bin/echo "OK."
- else
- /usr/bin/echo "$PROGNAME is not running."
- fi
-}
-
-
-restart()
-{
- stop
- start
-}
-
-
-status()
-{
-
- pgrep -f "^$BINPATH/$PROGNAME -f $CONF_FILE$" >/dev/null
- RET=$?
-
- if [ "$RET" -eq 0 ]; then
- /usr/bin/echo "$PROGNAME is running."
- else
- /usr/bin/echo "$PROGNAME is not running."
- fi
-
- return $RET
-}
-
-
-[ -x ${BINPATH}/${PROGNAME} ] || exit 5
-
-# We don't do anything if configuration file
-# is not present
-[ -f "$CONF_FILE" ] || exit 0
-
-case "$1" in
- start) start ;;
- stop) stop ;;
- restart) restart ;;
- reload) reload ;;
- status) status ;;
- *)
- /usr/bin/echo "Usage: $INIT_FILE {start|stop|restart|reload|status}"
- exit 1
- ;;
-esac
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list