AIXFTPログファイル方式



Aix Ftp Log File Method



オペレーティングシステム環境:IBMAIXバージョン6.1

目的:前日のログファイルを指定されたサーバーのディレクトリにFTPで転送します。



ファイル名はsendFile.shで、コードは次のとおりです。

#!/bin/sh #FTP the previous day's log file to the directory of the specified server # Receive the server IP address of the log file, and send the specified log file to this address. log_ip='10.1.5.160' #FTPUsername ftp_username=ibanknew #FTP ftp_password=ibanknew #FTPReceive log file directory ftp_path=/app/ibanknew/logs/26/91 #The directory where the log file to be sent is located filePath=/app/ibank/jboss-5.1.0.GA/server/default/log # File name of the log file to be sent, the format of the file name is server.log. Year Month Day (in the format yyyy-MM-dd) fileName='server.log.`TZ=aaa24 date +%Y-%m-%d`' cd $filePath echo $filePath/$fileName ftp -v -n ${log_ip} << EOF user ${ftp_username} ${ftp_password} cd $ftp_path asc prompt put $fileName bye EOF

各行の後の改行 '^ M'を削除する必要があることに注意してください。



コード '`TZ = aaa24 date +%Y-%m-%d`'の目的は、前日の日付を取得することです。

オペレーティングシステムでcrontab-eを使用してcrontabを作成します。コードは次のとおりです。

0 5 * * * shパス/sendFile.sh



0 5 * * *は、以下のコマンドが毎日5時に実行されることを意味します。