![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 11:00 AM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 09:52 PM |
| check input = "empty" and "numeric" | geoffry | Shell Programming and Scripting | 6 | 12-13-2007 01:12 AM |
| Command similar to "touch" for modify File size | sriharshareddyk | UNIX for Advanced & Expert Users | 3 | 11-14-2007 09:43 PM |
| Maximum input file size in "Diff" Command | Neeraja | UNIX for Dummies Questions & Answers | 1 | 01-17-2007 06:09 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
"sed" to check file size & echo " " to destination file
Hi,
I've modified the syslogd source to include a thread that will keep track of a timer(or a timer thread). My intention is to check the file size of /var/log/messages in every one minute & if the size is more than 128KB, do a echo " " > /var/log/messages, so that the file size will be set back to zero. If somebody can help me with a sed command to check the size of messages & to do a echo "" > messages ,if the size is greater than 128KB, I'll really grateful. Wishes Jay Last edited by jockey007; 11-13-2007 at 11:47 AM. Reason: typo |
| Forum Sponsor | ||
|
|
|
|||
|
Thanks....
Now I'm using a busybox find, which doesn't have support for "-size" argument So i think a sed command that meets the requirement would be great. Please provide a sed command to check the file & then flush that file. Wishes Jay |
|
|||
|
Hi Porter,
The output of root@WiMAX-BS:/var/log ls -ld /var/log/messages -rw------- 1 root root 41994 Jan 23 03:16 /var/log/messages ========== Well.. I was thinking like 1) use the ls command grab the size value using the sed and 2) then if it is greater than 128KB, do an echo " " > /var/log/messages Now I've crond support, so I can add a script with above logic to cron job. Thanks Jay |