カテゴリー
SugiBlog Webエンジニアのためのお役立ちTips

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
3,033 views

PHPインストール

PHPのインストール時に使用できるシェルスクリプトです。
Apache1.X系とApache2.x系の2種類作成したもののご紹介です。

#!/bin/sh

#=======================================
# php configure script
# php version 5
# for apache version 1
#=======================================

ARGV=$@

if [ -e $ARGV ] ; then

	echo "Please enter the option!"
	echo "[Options]:"
	echo "test - 設定されているコンフィグオプションを表示します。"
	echo "exec - php5をビルドします。"

elif [ "$ARGV" = "test" ] ; then

	echo "./configure \\"
	echo "--with-apxs=/usr/local/apache/bin/apxs \\"
	echo "--enable-mbstring \\"
	echo "--enable-mbstr-enc-trans \\"
	echo "--enable-mbregex \\"
	echo "--enable-trans-sid \\"
	echo "--with-mysql=/usr/bin \\"
	echo "--with-config-file-path=/usr/local/lib"

elif [ "$ARGV" = "exec" ] ; then

	./configure \
	--with-apxs=/usr/local/apache/bin/apxs \
	--enable-mbstring \
	--enable-mbstr-enc-trans \
	--enable-mbregex \
	--enable-trans-sid \
	--with-mysql=/usr/bin \
	--with-config-file-path=/usr/local/lib

	ERROR=$?
	if [ "$ERROR" = "0" ] ; then
		echo "ビルドが終了しました。"
	fi

else

	echo "error: unknown option!"
	echo "[Options]:"
	echo "test - 設定されているコンフィグオプションを表示します。"
	echo "exec - php5をビルドします。"

fi

続きを読む…»

2,612 views

apache インストール

コンフィグ用シェルスクリプトを用意
apache.configure

#!/bin/sh
./configure \
--enable-module=so \
--enable-mods-shared=most \
--enable-ssl \
--with-ssl=/usr/share/ssl \
--enable-vhost-alias
apache.configure

make
make install

make clean
make distclean

確か1でも2でもいけるはず…

アップグレードでの再インストールの場合、設定ファイル・ドキュメントファイルは上書きされませんが、
ドキュメントルートのindex.htmlやapacheアイコンなどは上書きされます。

1,797 views

ディスクフォーマット・ファイルシステム作成

fdisk /dev/sda
対話形式
n - 新しい領域を作成
p - 基本領域
最初シリンダ(defaultを使用)
終点シリンダ(defaultを使用)
w - テーブルをディスクに書き込み、終了する
mke2fs –j /dev/sda1
mount /dev/sda1 /xxx/xxx
2,153 views

ファイルを添付してメール送信2

複数の画像を添付してメールを送信するフォームを作ったので参考に載せておきます。
要所のみで省略している部分もあります。
ここでは添付できるファイル数を5つで作成しています。

<form action="./confirm.php" method="post" enctype="multipart/form-data">
    <input type="file" size="30" name="upfile1"><br>
    <input type="file" size="30" name="upfile2"><br>
    <input type="file" size="30" name="upfile3"><br>
    <input type="file" size="30" name="upfile4"><br>
    <input type="file" size="30" name="upfile5"><br>
    <input type="submit" name="submit" value="内容確認">
    <input type="reset" value="リセット">
</form>
<?php
// 共通初期設定
//{
    // 拡張子制限(0=しない・1=する)
    $ext_denied = 1;
    // 許可する拡張子リスト
    $ext_allow1 = "jpg";
    $ext_allow2 = "jpeg";
    $ext_allow3 = "gif";
    // 配列に格納しておく
    $EXT_ALLOWS = array($ext_allow1, $ext_allow2, $ext_allow3);

    // アップロード容量制限(0=しない・1=する)
    $maxmemory = 1;
    // 最大容量(KB)
    $max = 3000;
//}
?>

続きを読む…»

15,609 views