2006-08-01から1ヶ月間の記事一覧

PerlでSMTP Authメールの送信

use Net::SMTP_auth; sub smtpauthsend{ my($filename) = @_; $smtp = Net::SMTP_auth->new($smtpserver); $smtp->auth('LOGIN', $username, $password); $smtp->mail('aaa@aaa.aaa.com'); $smtp->to('aaa@aaa.aaa.com'); $smtp->cc('aaa@aaa.aaa.com'); $sm…

PHP mailコマンドのデバッグ方法

PHP

参照URL http://wiki.poyo.jp/read/PHP/tips/mail/function_mail echo '' | php -d sendmail_path="cat -"

アルゴリズムの問題いろいろ

合計金額になるすべてのお金の組み合わせを計算する。 例:10ドル、5ドル、1ドルを組み合わせて123ドルになるのは何通り? use strict; sub f{ my( $amount, @curs ) = @_; my $cur = shift @curs; my $total; return 0 unless $cur; if( @curs == 0 ) { …

sshのrootのログインの禁止

SSH

/etc/ssh/sshd_config を以下のように修正する PermitRootLogin yes <- rootログインあり PermitRootLogin no <- rootログイン無し PermitRootLogin forced-commands-only <- rootでも特定のコマンドのみアクセス許可/root/.ssh/authorized_keys のサンプル …

find の使い方メモ

# find -name ".svn" -exec rm -rf {} \; # "foo bar/" のような空白を含むファイル名の場合に動作しない # find . -name ".svn" -print |xargs rm -rf # ヌル文字をセパレータにしてから、xargsに渡し、xargsでは、-0 により、ヌル文字区切りを認識する。 #…

Bashメモ

ディレクトリ一覧 find . -type d |sed 's!^\./!!' 日付を表示 date +\%Y\%m\%d 配列 と forループ AA=(aa bb cc dd ee) for a in ${AA[@]}; do echo $a done 1行で。 for d in `ls`; do コマンド; done for i in `seq 1 10`; do mysql -e "select count(*) …

バックアップ&リストア Backup & Restore

/usr/bin/mysqldump -u root -p\'$pass\' --flush-logs \ --delete-master-logs --all-databases | /usr/bin/gzip > /backup/$server/dbdump.sql.gz

date コマンドメモ

# date +%Y%m%d 20060811 # date +%Y%m%d -d '1 day ago' 20060810

[Postfix] telnetでテスト

SMTP # telnet smtp.example.com 25 HELO mymachine MAIL FROM: <from@example.com> RCPT TO: <to@example.com> DATA From: from@example.com To: to@example.com Subject: TEST mail body is here. . QUIT ||< -SMTP Auth >|| 220 smtp.example.com ESMTP EHLO [10.0.7.1] 250-smtp.example.co</to@example.com></from@example.com>…

NICに複数のIPアドレスを追加する。

ifconfig eth0:1 192.168.0.101 netmask 255.255.255.0 up ifconfig eth0:2 192.168.0.102 netmask 255.255.255.0 up ifconfig eth0:3 192.168.0.103 netmask 255.255.255.0 up