--- tpop3d Fri Feb 16 11:58:24 2001
+++ tpop3d-wait-for-mysql Fri Feb 16 11:59:55 2001
@@ -1,3 +1,3 @@
-#!/bin/sh
+#!/bin/bash
#
# tpop3d:
@@ -16,4 +16,20 @@
# virtual-domain users to log in from anywhere they like.
#
+#
+# Modified by Roberto Braga v 1.1.1 2001/02/16
+# The script has been modified in order to give enough time to Mysqld to
+# create the sock file. I have this necessity because tpop3d verifies the
+# connection before starting and my system goes up quickly.
+# This script tests the presence of mysql.sock file for 10 times with 1
+# second of pause betwen each retry.
+# If the check fails it tries to start tpop3d anyway.
+# If mysql.sock exists when the script starts, no pause occours.
+#
+#
+# A T T E N T I O N !!
+#
+# USE THIS SCRIPT ONLY if you use a localhost connection with Mysqld
+#
+#
# chkconfig: 345 86 14
# description: tpop3d is a small, fast, extensible POP3 server
@@ -29,7 +45,5 @@
[ "${NETWORKING}" = "no" ] && exit 0
-DAEMON=/software/sbin/tpop3d
-
-[ -f $DAEMON ] || exit 0
+[ -f /usr/tpop3d/tpop3d ] || exit 0
# See how we were called.
@@ -38,8 +52,24 @@
# Start daemons.
echo -n "Starting tpop3d: "
- $DAEMON -f /etc/tpop3d.conf
- echo -n "tpop3d "
- $DAEMON -f /etc/tpop3d-secure.conf
- echo "tpop3d-secure "
+ #modify the next line to increse or decrease the number of retry
+ for i in `seq 1 10`;
+ do
+ # modify the path in accordance with your mysql.sock file
+ if [ -e /var/lib/mysql/mysql.sock ] ; then
+ #se Mysql è su allora parte anche tpop3d
+ /usr/tpop3d/tpop3d -f /usr/tpop3d/tpop3d.conf
+ echo "tpop3d started "
+ touch /var/lock/subsys/tpop3d
+ #/usr/tpop3d/tpop3d -f /usr/tpop3d/tpop3d-secure.conf
+ #echo "tpop3d-secure started"
+ exit 0 # exit the script
+ else
+ # modify the next line to increse the pause between each retry minimum is 1 second
+ sleep 1s
+ echo -n "+"
+ fi
+ done
+ echo " NOT STARTED - no Mysqld sock found - try to start it anyway."
+ /usr/tpop3d/tpop3d -f /usr/tpop3d/tpop3d.conf
touch /var/lock/subsys/tpop3d
;;
@@ -49,5 +79,5 @@
if [ -e /var/lock/subsys/tpop3d ] ; then
# we use pidof here; this is linux-specific
- kill -TERM `pidof tpop3d`
+ killall tpop3d
echo tpop3d
rm -f /var/lock/subsys/tpop3d
syntax highlighted by Code2HTML, v. 0.9.1