回答編集履歴
4
Update
test
CHANGED
@@ -10,12 +10,10 @@
|
|
10
10
|
```bash
|
11
11
|
function mput_log2() {
|
12
12
|
if [ ${#LOG2[@]} -gt 0 ];then
|
13
|
-
local -i max
|
14
|
-
max=$((${#LOG2[@]} - 1))
|
15
|
-
[ $
|
13
|
+
[ ${#LOG2[@]} -gt 3 ] && LOG2=(${LOG2[@]:0:3})
|
16
|
-
for
|
14
|
+
for l in ${LOG2[@]};
|
17
15
|
do
|
18
|
-
echo "
|
16
|
+
echo "put $l"
|
19
17
|
done
|
20
18
|
fi
|
21
19
|
}
|
3
Update
test
CHANGED
@@ -9,9 +9,9 @@
|
|
9
9
|
また、ログファイルがある場合にのみ転送を行う様にします。
|
10
10
|
```bash
|
11
11
|
function mput_log2() {
|
12
|
-
if [ ${#LOG2} -gt 0 ];then
|
12
|
+
if [ ${#LOG2[@]} -gt 0 ];then
|
13
13
|
local -i max
|
14
|
-
max=$((${#LOG2} - 1))
|
14
|
+
max=$((${#LOG2[@]} - 1))
|
15
15
|
[ $max -gt 2 ] && max=2
|
16
16
|
for i in $(seq 0 $max);
|
17
17
|
do
|
2
Update
test
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
`exit status` と条件に適合するログファイルの個数を調べてみてはどうでしょうか。
|
2
2
|
```bash
|
3
3
|
LOG2=(`find /var/log/test/sample*.lgz -mtime +0 -and -mtime -4 2>/dev/null`)
|
4
|
-
if [ $? -ne 0 ] || [ ${#LOG2} -eq 0 ]; then
|
4
|
+
if [ $? -ne 0 ] || [ ${#LOG2[@]} -eq 0 ]; then
|
5
5
|
echo 'Warning: None log file in LOG2' >&2
|
6
6
|
fi
|
7
7
|
```
|
1
Update
test
CHANGED
@@ -11,8 +11,8 @@
|
|
11
11
|
function mput_log2() {
|
12
12
|
if [ ${#LOG2} -gt 0 ];then
|
13
13
|
local -i max
|
14
|
-
max=${#LOG2}
|
14
|
+
max=$((${#LOG2} - 1))
|
15
|
-
[ $max -gt
|
15
|
+
[ $max -gt 2 ] && max=2
|
16
16
|
for i in $(seq 0 $max);
|
17
17
|
do
|
18
18
|
echo "mput ${LOG2[$i]}"
|