日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux shell 0403-011,shell脚本出现 test:0403-004 Specify a paramater with this command

發(fā)布時間:2024/7/23 linux 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux shell 0403-011,shell脚本出现 test:0403-004 Specify a paramater with this command 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

下面是小弟從網(wǎng)上找的一段SHELL代碼,用來解決WEBLOGIC日志不能自動分割的問題,可是SHELL腳本有誤,運(yùn)行的時候報

start.sh【7】:test:0403-004?Specify?a?paramater?with?this?command?請各位大蝦幫幫忙

You?can?use?the?following?script?to?rotate,?by?size,?the?nohup.out?file.?The?script?takes?a?size?parameter?to?check?against?the?size?of?the?nohup.out?file.?If?the?file?is?greater?than?that?specified?size,?it?will?copy?the?file?to?a?logs?directory?appending?the?date?and?time?to?it?and?will?empty?the?existing?nohup.out?and?continue?the?logging.

The?script?should?be?started?as?a?daemon?process?so?it?is?continually?running?in?the?background.?It?should?be?run?from?where?you?store?nohup.out?-?usually?the?domain?directory,?and?make?sure?that?there?is?a?logs?directory?underneath?the?directory?where?you?have?nohup.out.

The?script?will?run?continuously?until?killed?by?user.

-----------

#!/bin/bash

counter=1

file=nohup.out

while?[?"$counter"?!=?"0"?]

do

size=`ls?-la?nohup.out?|?awk?'{print?$5}'`

if?[?$size?-gt?$1?]

then

date=`date?+%m%d%y-%H%M%S`

cp?"$file"?log/"$file.$date"

cat?/dev/null?>?"$file"

fi

done

-----------

Thanks?and?please?let?me?know?if?it?works?at?your?end.

|

很明顯是需要一個參數(shù)么,在運(yùn)行這個腳本時你要指定"$1",是個整數(shù),就是if?[?$size?-gt?$1?]里面的,他就是用來分割文件大小的界限。

|

那你應(yīng)該看下,那個看那個存放拷貝后的目錄是不是存在,就是log/這個目錄,或者你可以重新指定一個目錄,比如指定到cp?"$file"?/var/log/[/color]"$file.$date",運(yùn)行完之后查看/var/log/是不是生成了那個拷貝后的文件。

總結(jié)

以上是生活随笔為你收集整理的linux shell 0403-011,shell脚本出现 test:0403-004 Specify a paramater with this command的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。