2009年4月25日土曜日

autoincrementリセット

ALTER TABLE [table_name] AUTO_INCREMENT=0;

2009年3月29日日曜日

hosts.deny hosts.allow

vi /etc/hosts.deny
ALL:ALL
*全て拒否した上で

vi /etc/hosts.allow
ALL:127.0.0.1
ALL:.xxx.ocn.ne.jp
*上記IPとリモートホストを許可

SSHだけだったら
sshd:

SSH&FTPだったら
ALL:

2009年3月18日水曜日

ディレクトリのファイルサイズ

# du -s -m /var/www

www以下の総容量をM(メガ)で表示

2009年3月17日火曜日

sarのインストール

# yum install -y sysstat

sar 1日の履歴出力

sar 1 3 ←1秒おきに3回出力

logファイルを毎日ローテに変更

# vi /etc/logrotate.d/httpd
/var/log/httpd/*log {
daily #毎日ローテ追加
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null true
endscript
}





 # vi /etc/logrotate.d/syslog
/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
   daily #毎日ローテ追加
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

logファイルを空にする

cp /dev/null access_log
cp /dev/null error_log

2009年3月16日月曜日

viでコピペ

yyで1行をコピー
pでペースト