Categories
SugiBlog ホームページ制作・システム開発

qmailの起動スクリプト

#!/bin/sh
# qmail: /var/qmail
. /etc/rc.d/init.d/functions

[ -f /var/qmail/rc ] || exit 0

case "$1" in
	start)

		# Start daemons.

		echo "Starting qmail."
		csh -cf '/var/qmail/rc &'

		# Starting tcpserver with pop3d
		/usr/local/bin/tcpserver -R 0 110 /var/qmail/bin/qmail-popup \
		mail.example.jp \
		/home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2&>1 \
		| /var/qmail/bin/splogger pop3d &

		if [ $? = 0 ] ; then
			echo "pop3d starting:" `echo_success`
		else
			echo "pop3d starting:" `echo_failure`
		fi

		# Starting tcpserver with smtpd
		/usr/local/bin/tcpserver -v -x /home/vpopmail/etc/tcp.smtp.cdb \
		-c 100 -u qmaild -g nofiles \
		0 smtp /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd &

		/usr/local/bin/tcpserver -v -x /home/vpopmail/etc/tcp.smtp.cdb \
		-c 100 -u qmaild -g nofiles \
		0 587 /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd &

		if [ $? = 0 ] ; then
			echo "smtpd starting:" `echo_success`
		else
			echo "smtpd starting:" `echo_failure`
		fi

		touch /var/lock/subsys/qmaild
		;;

	stop)

		# Stop daemons.
		echo "Shutting down qmail."

		killall -g qmail-send
		if [ $? = 0 ] ; then
			echo "stopping smtpd:" `echo_success`
		else
			echo "stopping smtpd:" `echo_failure`
		fi

		killall -g tcpserver

		if [ $? = 0 ] ; then
			echo "stopping pop3d:" `echo_success`
		else
			echo "stopping pop3d:" `echo_failure`
		fi

		rm -f /var/lock/subsys/qmaild
		;;

	restart)

		$0 stop
		$0 start
		;;

	*)

		echo "Usage: `basename $0` {start|stop|restart}" >&2
		exit 64
		;;
esac

exit 0
788 views

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*