rbatch 1.8.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG +43 -0
  3. data/HOW_TO_TEST.md +9 -0
  4. data/README.ja.md +6 -5
  5. data/README.md +6 -5
  6. data/Rakefile +1 -38
  7. metadata +78 -112
  8. data/sample/bin/log_backup.rb +0 -20
  9. data/sample/bin/test.rb +0 -6
  10. data/sample/bin/test2.rb +0 -3
  11. data/sample/conf/log_backup.yaml +0 -4
  12. data/sample/log/20130120_apache_log_insert.log +0 -171
  13. data/sample/log/20130120_openam_log_insert.log +0 -143
  14. data/sample/log/20130121_apache_log_insert.log +0 -103
  15. data/sample/log/20130121_file_batch_copy.log +0 -15
  16. data/sample/log/20130121_openam_log_insert.log +0 -39
  17. data/sample/log/20130121_webagent_log_insert.log +0 -432
  18. data/sample/log/20130122_apache_log_insert.log +0 -153
  19. data/sample/log/20130122_openam_log_insert.log +0 -374
  20. data/sample/log/20130122_webagent_log_insert.log +0 -144
  21. data/sample/log/20130129_log_backup.log +0 -95
  22. data/sample/log/20130131_apache_log_insert.log +0 -23
  23. data/sample/log/20130209_test.log +0 -128
  24. data/sample/log/20130210_test.log +0 -68
  25. data/sample/moto/README +0 -16
  26. data/sample/moto/auditlog.src.zip +0 -0
  27. data/sample/moto/build.gradle +0 -106
  28. data/sample/moto/gradle/wrapper/gradle-wrapper.jar +0 -0
  29. data/sample/moto/gradle/wrapper/gradle-wrapper.properties +0 -7
  30. data/sample/moto/gradle.properties +0 -12
  31. data/sample/moto/gradlew +0 -164
  32. data/sample/moto/gradlew.bat +0 -90
  33. data/sample/moto/settings.gradle +0 -1
  34. data/sample/moto/src/main/bin/delete_auditlog.sh +0 -176
  35. data/sample/moto/src/main/bin/delete_workflowinstances.sh +0 -315
  36. data/sample/moto/src/main/bin/import_auth_log.sh +0 -23
  37. data/sample/moto/src/main/etc/delete_auditlog.param +0 -39
  38. data/sample/moto/src/main/etc/delete_workflowinstances.param +0 -30
  39. data/sample/moto/src/main/etc/log4j.xml +0 -28
  40. data/sample/moto/src/main/etc/status.properties +0 -27
  41. data/sample/moto/src/main/etc/sysparam.properties +0 -54
  42. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/DateUtil.java +0 -48
  43. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/ImportAuthLogMain.java +0 -36
  44. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/LogReader.java +0 -521
  45. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/MysqlController.java +0 -315
  46. data/sample/moto/src/main/logrotate/delete_auditlog +0 -6
  47. data/sample/moto/src/main/logrotate/delete_workflowinstanceslog +0 -6
  48. data/sample/moto/src/main/sql/tables.sql +0 -36
@@ -1,106 +0,0 @@
1
- apply {
2
- plugin 'java'
3
- plugin 'maven'
4
- plugin 'eclipse'
5
- }
6
-
7
- repositories {
8
- mavenRepo url: "http://192.175.204.100/nexus/content/groups/public/"
9
- }
10
-
11
- // Project Settings
12
- group = groupId
13
- version = "${rootProject.releaseVersion}-${rootProject.releaseBuildNumber}"
14
-
15
- // Java Settings
16
- sourceCompatibility = 1.6
17
- targetCompatibility = 1.6
18
- [compileJava,compileTestJava].each { c->
19
- c.options.encoding = 'UTF-8'
20
- c.options.debug(debugLevel: 'source,lines,vars')
21
- }
22
-
23
- dependencies {
24
- compile 'mysql:mysql-connector-java:5.1.20'
25
- compile 'log4j:log4j:1.2.16'
26
- testCompile 'mockit:jmockit:0.999.4'
27
- testCompile 'junit:junit:4.10'
28
- }
29
-
30
- task sourcesJar(type: Jar, dependsOn:classes) {
31
- classifier = 'sources'
32
- from sourceSets.main.allSource
33
- }
34
-
35
- artifacts {
36
- archives sourcesJar
37
- }
38
-
39
- eclipse {
40
- pathVariables 'GRADLE_USER_HOME': gradle.gradleUserHomeDir
41
- }
42
-
43
-
44
- // Release Dist Setting
45
- task releaseDist(type: Zip) {
46
- from("src/main/bin") {
47
- into "${baseName}-${version}/bin"
48
- }
49
- from("src/main/etc") {
50
- into "${baseName}-${version}/etc"
51
- }
52
- from("src/main/logrotate") {
53
- into "${baseName}-${version}/logrotate"
54
- }
55
- from("src/main/sql") {
56
- into "${baseName}-${version}/sql"
57
- }
58
- from(jar.outputs.files) {
59
- into "${baseName}-${version}/lib"
60
- }
61
- from(configurations.matching { it.name in ['compile'] }.flatten()) {
62
- into "${baseName}-${version}/lib"
63
- }
64
- }
65
-
66
- releaseDist.dependsOn build
67
-
68
- /**
69
- mainClassName = "jp.ossc.imortAuditlog.ImportAuthLogMain"
70
- applicationName = 'import_auth_log'
71
-
72
- startScripts << {
73
- println "Adding classpath setting to ${outputDir}/${applicationName}"
74
- def scriptFile = file "${outputDir}/${applicationName}"
75
- scriptFile.text = scriptFile.text.replace('CLASSPATH=$APP_HOME/lib', 'CLASSPATH=$APP_HOME/etc:$APP_HOME/lib')
76
-
77
- println "Adding classpath setting to ${outputDir}/${applicationName}.bat"
78
- scriptFile = file "${outputDir}/${applicationName}.bat"
79
- scriptFile.text = scriptFile.text.replace('CLASSPATH=%APP_HOME%\\lib', 'CLASSPATH=%APP_HOME%\\etc;%APP_HOME%\\lib')
80
- }
81
-
82
- applicationDistribution.from("src/main/bin") {
83
- into "bin"
84
- }
85
-
86
- applicationDistribution.from("src/main/etc") {
87
- into "etc"
88
- }
89
-
90
- applicationDistribution.from("src/main/logrotate") {
91
- into "logrotate"
92
- }
93
-
94
- applicationDistribution.from("src/main/sql") {
95
- into "sql"
96
- }
97
-
98
- // workaround: because distZip task don't execute sourcesJar task.
99
- distZip.dependsOn sourcesJar
100
- **/
101
-
102
- // Gradle Wrapper Setting
103
-
104
- task wrapper(type: Wrapper) {
105
- gradleVersion = '1.0'
106
- }
@@ -1,7 +0,0 @@
1
- #Thu Mar 22 16:58:22 JST 2012
2
- distributionBase=GRADLE_USER_HOME
3
- distributionPath=wrapper/dists
4
- zipStoreBase=GRADLE_USER_HOME
5
- zipStorePath=wrapper/dists
6
- #distributionUrl=http\://services.gradle.org/distributions/gradle-1.0-bin.zip
7
- distributionUrl=http\://192.175.204.100/nas/os_hiizon/gradle/gradle-1.0-milestone-9-bin.zip
@@ -1,12 +0,0 @@
1
- ##
2
- ## OpenStandia/Portal
3
- ##
4
-
5
- openamVersion=954
6
-
7
- ## Release
8
- groupId=jp.openstandia.ssoidm
9
- releaseVersion=2.14
10
- releaseBuildNumber=SNAPSHOT
11
- buildOffline=false
12
-
data/sample/moto/gradlew DELETED
@@ -1,164 +0,0 @@
1
- #!/bin/bash
2
-
3
- ##############################################################################
4
- ##
5
- ## Gradle start up script for UN*X
6
- ##
7
- ##############################################################################
8
-
9
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
- DEFAULT_JVM_OPTS=""
11
-
12
- APP_NAME="Gradle"
13
- APP_BASE_NAME=`basename "$0"`
14
-
15
- # Use the maximum available, or set MAX_FD != -1 to use that value.
16
- MAX_FD="maximum"
17
-
18
- warn ( ) {
19
- echo "$*"
20
- }
21
-
22
- die ( ) {
23
- echo
24
- echo "$*"
25
- echo
26
- exit 1
27
- }
28
-
29
- # OS specific support (must be 'true' or 'false').
30
- cygwin=false
31
- msys=false
32
- darwin=false
33
- case "`uname`" in
34
- CYGWIN* )
35
- cygwin=true
36
- ;;
37
- Darwin* )
38
- darwin=true
39
- ;;
40
- MINGW* )
41
- msys=true
42
- ;;
43
- esac
44
-
45
- # For Cygwin, ensure paths are in UNIX format before anything is touched.
46
- if $cygwin ; then
47
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48
- fi
49
-
50
- # Attempt to set APP_HOME
51
- # Resolve links: $0 may be a link
52
- PRG="$0"
53
- # Need this for relative symlinks.
54
- while [ -h "$PRG" ] ; do
55
- ls=`ls -ld "$PRG"`
56
- link=`expr "$ls" : '.*-> \(.*\)$'`
57
- if expr "$link" : '/.*' > /dev/null; then
58
- PRG="$link"
59
- else
60
- PRG=`dirname "$PRG"`"/$link"
61
- fi
62
- done
63
- SAVED="`pwd`"
64
- cd "`dirname \"$PRG\"`/"
65
- APP_HOME="`pwd -P`"
66
- cd "$SAVED"
67
-
68
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69
-
70
- # Determine the Java command to use to start the JVM.
71
- if [ -n "$JAVA_HOME" ] ; then
72
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73
- # IBM's JDK on AIX uses strange locations for the executables
74
- JAVACMD="$JAVA_HOME/jre/sh/java"
75
- else
76
- JAVACMD="$JAVA_HOME/bin/java"
77
- fi
78
- if [ ! -x "$JAVACMD" ] ; then
79
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80
-
81
- Please set the JAVA_HOME variable in your environment to match the
82
- location of your Java installation."
83
- fi
84
- else
85
- JAVACMD="java"
86
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87
-
88
- Please set the JAVA_HOME variable in your environment to match the
89
- location of your Java installation."
90
- fi
91
-
92
- # Increase the maximum file descriptors if we can.
93
- if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94
- MAX_FD_LIMIT=`ulimit -H -n`
95
- if [ $? -eq 0 ] ; then
96
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97
- MAX_FD="$MAX_FD_LIMIT"
98
- fi
99
- ulimit -n $MAX_FD
100
- if [ $? -ne 0 ] ; then
101
- warn "Could not set maximum file descriptor limit: $MAX_FD"
102
- fi
103
- else
104
- warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT"
105
- fi
106
- fi
107
-
108
- # For Darwin, add options to specify how the application appears in the dock
109
- if $darwin; then
110
- JAVA_OPTS="$JAVA_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111
- fi
112
-
113
- # For Cygwin, switch paths to Windows format before running java
114
- if $cygwin ; then
115
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117
-
118
- # We build the pattern for arguments to be converted via cygpath
119
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120
- SEP=""
121
- for dir in $ROOTDIRSRAW ; do
122
- ROOTDIRS="$ROOTDIRS$SEP$dir"
123
- SEP="|"
124
- done
125
- OURCYGPATTERN="(^($ROOTDIRS))"
126
- # Add a user-defined pattern to the cygpath arguments
127
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129
- fi
130
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
131
- i=0
132
- for arg in "$@" ; do
133
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135
-
136
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138
- else
139
- eval `echo args$i`="\"$arg\""
140
- fi
141
- i=$((i+1))
142
- done
143
- case $i in
144
- (0) set -- ;;
145
- (1) set -- "$args0" ;;
146
- (2) set -- "$args0" "$args1" ;;
147
- (3) set -- "$args0" "$args1" "$args2" ;;
148
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154
- esac
155
- fi
156
-
157
- # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158
- function splitJvmOpts() {
159
- JVM_OPTS=("$@")
160
- }
161
- eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162
- JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163
-
164
- exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@@ -1,90 +0,0 @@
1
- @if "%DEBUG%" == "" @echo off
2
- @rem ##########################################################################
3
- @rem
4
- @rem Gradle startup script for Windows
5
- @rem
6
- @rem ##########################################################################
7
-
8
- @rem Set local scope for the variables with windows NT shell
9
- if "%OS%"=="Windows_NT" setlocal
10
-
11
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
- set DEFAULT_JVM_OPTS=
13
-
14
- set DIRNAME=%~dp0
15
- if "%DIRNAME%" == "" set DIRNAME=.
16
- set APP_BASE_NAME=%~n0
17
- set APP_HOME=%DIRNAME%
18
-
19
- @rem Find java.exe
20
- if defined JAVA_HOME goto findJavaFromJavaHome
21
-
22
- set JAVA_EXE=java.exe
23
- %JAVA_EXE% -version >NUL 2>&1
24
- if "%ERRORLEVEL%" == "0" goto init
25
-
26
- echo.
27
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
- echo.
29
- echo Please set the JAVA_HOME variable in your environment to match the
30
- echo location of your Java installation.
31
-
32
- goto fail
33
-
34
- :findJavaFromJavaHome
35
- set JAVA_HOME=%JAVA_HOME:"=%
36
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
-
38
- if exist "%JAVA_EXE%" goto init
39
-
40
- echo.
41
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
- echo.
43
- echo Please set the JAVA_HOME variable in your environment to match the
44
- echo location of your Java installation.
45
-
46
- goto fail
47
-
48
- :init
49
- @rem Get command-line arguments, handling Windowz variants
50
-
51
- if not "%OS%" == "Windows_NT" goto win9xME_args
52
- if "%@eval[2+2]" == "4" goto 4NT_args
53
-
54
- :win9xME_args
55
- @rem Slurp the command line arguments.
56
- set CMD_LINE_ARGS=
57
- set _SKIP=2
58
-
59
- :win9xME_args_slurp
60
- if "x%~1" == "x" goto execute
61
-
62
- set CMD_LINE_ARGS=%*
63
- goto execute
64
-
65
- :4NT_args
66
- @rem Get arguments from the 4NT Shell from JP Software
67
- set CMD_LINE_ARGS=%$
68
-
69
- :execute
70
- @rem Setup the command line
71
-
72
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
-
74
- @rem Execute Gradle
75
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
-
77
- :end
78
- @rem End local scope for the variables with windows NT shell
79
- if "%ERRORLEVEL%"=="0" goto mainEnd
80
-
81
- :fail
82
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
- rem the _cmd.exe /c_ return code!
84
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
- exit /b 1
86
-
87
- :mainEnd
88
- if "%OS%"=="Windows_NT" endlocal
89
-
90
- :omega
@@ -1 +0,0 @@
1
-
@@ -1,176 +0,0 @@
1
- #!/bin/bash
2
-
3
- ### スクリプトファイルの場所
4
- BASEDIR=`dirname $0`
5
- ### paramファイル
6
- PARAM=${BASEDIR}/../etc/delete_auditlog.param
7
- ## 今日の日付
8
- CURRENT_TIME="date '+%Y-%m-%d %H:%M:%S'"
9
- ## hostname
10
- HOSTNAME=$(hostname)
11
-
12
-
13
- ### ログメッセージ、ナンバー、ステータスの配列
14
- declare -a LOG_MSG
15
- LOG_MSG[0001]="INFO 認証アクセスログ削除ツールを開始します。"
16
- LOG_MSG[0002]="INFO 認証アクセスログ削除ツールを終了します。"
17
- LOG_MSG[0003]="ERR 認証アクセスログ削除ツールが異常終了しました。"
18
-
19
- LOG_MSG[0101]="INFO チェック処理を開始します。"
20
- LOG_MSG[0102]="INFO チェック処理を終了します。"
21
- LOG_MSG[0103]="ERR パラメータファイルが読み込めませんでした。"
22
-
23
- LOG_MSG[0201]="INFO 削除件数確認処理を開始します。"
24
- LOG_MSG[0202]="INFO 削除件数確認処理を終了します。"
25
- LOG_MSG[0203]="ERR テーブルからの削除件数取得に失敗しました。"
26
- LOG_MSG[0204]="INFO 削除対象レコードがありませんでした。"
27
-
28
- LOG_MSG[0301]="INFO レコード削除処理を開始します。"
29
- LOG_MSG[0302]="INFO レコード削除処理を終了します。"
30
- LOG_MSG[0303]="ERR テーブルからのレコード削除に失敗しました。"
31
-
32
- LOG_MSG[0401]="INFO ログ出力処理を開始します。"
33
- LOG_MSG[0402]="INFO ログ出力処理を終了します。"
34
- LOG_MSG[0403]="ERR ログ出力に失敗しました。"
35
-
36
-
37
- ####### utility functions
38
- ## ----------------------------------------
39
- ## output msg to log file
40
- ## params $1 status code
41
- ##
42
- print_log () {
43
- local len=$(expr length $1)
44
- if [ 4 -eq $len ];then
45
- echo -e `eval ${CURRENT_TIME}` $HOSTNAME $1 ${LOG_MSG[$1]} >> ${LOG_FILE}
46
- else
47
- echo -e `eval ${CURRENT_TIME}` $HOSTNAME $1 >> ${LOG_FILE}
48
- fi
49
- }
50
-
51
- ## ----------------------------------------
52
- ## output multiple msg to log
53
- ## params $@ status codes
54
- ##
55
- print_multi_log () {
56
- for arg in $@
57
- do
58
- print_log $arg
59
- done
60
- }
61
-
62
- ## ----------------------------------------
63
- ## mysql cmd
64
- ## params なし
65
- ##
66
- mysql_cmd () {
67
- # mysql -u${DB_USER} -p${DB_PASSWD}
68
- ## IPアドレスを指定してDBに接続の場合
69
- /usr/bin/mysql -u${DB_USER} -p${DB_PASSWD} -h ${MYSQLHOST}
70
- }
71
-
72
- ## ----------------------------------------
73
- ## error trap function
74
- ## params $1 status code
75
- ##
76
- err_handler () {
77
- local err_status=${1:-$?}
78
- print_multi_log $err_status "0003"
79
- exit 1
80
- }
81
-
82
-
83
- ## ========== main logic ==========
84
- ##### パラメータファイルのチェック #####
85
- if [ -e $PARAM ]
86
- then
87
- source $PARAM
88
-
89
- # ログディレクトリ作成
90
- mkdir -p ${LOG_DIR}
91
-
92
- ## print start log
93
- print_multi_log "0001" "0101" "0102"
94
- else
95
- SCRIPTNAME=`basename $0`
96
- echo `eval $CURRENT_TIME` $HOSTNAME 0103 ${LOG_MSG[0103]}>> \
97
- ${BASEDIR}/../log/${SCRIPTNAME%.sh}.log
98
- exit 1
99
- fi
100
-
101
-
102
- ##### 削除レコード数を取得 #####
103
- trap 'err_handler "0203"' ERR
104
- ## 開始ログ出力
105
- print_log "0201"
106
-
107
- ## 削除件数取得
108
- ## authentication_logテーブルより削除件数取得
109
- authentication_cnt=$(echo "select count(date) from ${AUTHENTICATION_LOG_TBL} \
110
- where date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
111
- | mysql_cmd 2> /dev/null)
112
- authentication_cnt=$(echo $authentication_cnt | sed -e s/count\(date\)//)
113
-
114
- ## authorization_logテーブルより削除件数取得
115
- authorization_cnt=$(echo "select count(date) from ${AUTHORIZATION_LOG_TBL} \
116
- where date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
117
- | mysql_cmd 2> /dev/null)
118
- authorization_cnt=$(echo $authorization_cnt | sed -e s/count\(date\)//)
119
-
120
- ## access_logテーブルより削除件数取得
121
- access_cnt=$(echo "select count(date) from ${ACCESS_LOG_TBL} \
122
- where date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
123
- | mysql_cmd 2> /dev/null)
124
- access_cnt=$(echo $access_cnt | sed -e s/count\(date\)//)
125
-
126
- ## 削除対象が0の場合、件数0をログに出力後、正常終了
127
- [ 0 -eq $access_cnt ] && [ 0 -eq $authentication_cnt ] && [ 0 -eq $authorization_cnt ] && \
128
- print_multi_log "0204" "0002" && exit 0
129
-
130
- ## 終了ログ出力
131
- print_log "0202"
132
-
133
-
134
-
135
- ##### 対象レコードを削除 #####
136
- trap 'err_handler "0303"' ERR
137
- ## 開始ログ出力
138
- print_log "0301"
139
-
140
- ## レコード削除
141
- [ $authentication_cnt -gt 0 ] && echo \
142
- "delete from ${AUTHENTICATION_LOG_TBL} where \
143
- date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
144
- | mysql_cmd > /dev/null 2>&1
145
-
146
- [ $authorization_cnt -gt 0 ] && echo \
147
- "delete from ${AUTHORIZATION_LOG_TBL} where \
148
- date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
149
- | mysql_cmd > /dev/null 2>&1
150
-
151
- [ $access_cnt -gt 0 ] && echo \
152
- "delete from ${ACCESS_LOG_TBL} where \
153
- date < adddate(curdate(), interval -$DAYS_GO_BACK day);" \
154
- | mysql_cmd > /dev/null 2>&1
155
-
156
- ## 終了ログ出力
157
- print_log "0302"
158
-
159
-
160
-
161
- ##### ログへ削除件数の出力 #####
162
- trap 'err_handler "0403"' ERR
163
- ## 開始ログ出力
164
- print_log "0401"
165
-
166
- ## 削除件数をログに書込み
167
- echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
168
- "authentication_logテーブルより${authentication_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
169
- echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
170
- "authorization_logテーブルより${authorization_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
171
- echo -e `eval ${CURRENT_TIME}` $HOSTNAME \
172
- "access_logテーブルより${access_cnt}件のレコードを削除しました。" 2>/dev/null >> ${LOG_FILE}
173
-
174
- ## 終了ログ出力
175
- print_multi_log "0402" "0002"
176
-