#!/bin/sh # # tcpserver This shell script takes care of starting and stopping # tcpserver for the smtp and pop3 port. # # chkconfig: 2345 80 19 # description: tcpserver uses tcpserver for the SMTP and pop3 port. \ # tcpserver is more suitable for qmail than inetd. # processname: tcpserver # config: /etc/tcp.smtp.cdb # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network export PATH=$PATH:/var/qmail/bin:/usr/local/bin # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 [ -f /usr/sbin/sendmail ] || exit 0 QMAILD_UID=`id -u qmaild` QMAILD_GID=`id -g qmaild` FQDN="`hostname`.`grep domain /etc/resolv.conf | sed \"s/domain//\" | sed \"s/ *//\"`" # See how we were called. case "$1" in start) # Start daemons. echo -n "Starting tcpserver: " tcpserver -R -x/etc/tcp.smtp.cdb -u "$QMAILD_UID" -g "$QMAILD_GID" \ 0 smtp /var/qmail/bin/qmail-smtpd & tcpserver -H -R 0 pop3 /var/qmail/bin/qmail-popup $FQDN \ /var/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir & TCPSERVERPID=`pidofproc tcpserver` base=tcpserver if [ -z "$TCPSERVERPID" ]; then failure $"$base startup" else touch /var/lock/subsys/tcpserver success $"$base startup" fi echo ;; stop) # Stop daemons. echo -n "Shutting down tcpserver: " killproc tcpserver echo rm -f /var/lock/subsys/tcpserver ;; restart) $0 stop $0 start ;; status) status tcpserver ;; *) echo "Usage: tcpserver {start|stop|restart|status}" exit 1 esac exit 0