Sponsored Content
Full Discussion: Throttling
Top Forums Shell Programming and Scripting Throttling Post 302187527 by era on Monday 21st of April 2008 10:45:11 AM
Old 04-21-2008
If the log file might still grow while you are handling it, doing this in a shell script sounds rather dangerous. From Perl or Python or C, you might be able to use some file locking primitives to coordinate with processes which might be writing to the file concurrently.

Having said that, consider this (lack of) proof of concept.

Code:
while true; do
  if head -n 200 file | xargs application; then
    sed 1,200d file >file.tmp
    mv -f file.tmp file
    test -s file || break  # quit loop if file empty
  else
    echo "application failed ($?); not removing first 200 lines -- retrying in a while" >&2
  fi
  sleep 600 # or something like that here, maybe?
done

 

4 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Throttling Process Resource Consumption

Is there a way of throttling a process resources, something akin to limits but for processes not users? ie I want processX to be restricted in the amount of memory it can consume. For process cpu I guess I can simply nice the process, but total memory consumption is my primary concern. (3 Replies)
Discussion started by: humbletech99
3 Replies

2. UNIX for Advanced & Expert Users

Interrupt storm detected on "irq 20" throttling interrupt source

I receive the following warning messages on a very new machine which has FreeBSD 8.1 x64 installed on it: Interrupt storm detected on "irq 20" throttling interrupt source It is unclear what this means and what its origins are (motherboard? CPU? RAM?). I can start the desktop and the message is... (4 Replies)
Discussion started by: figaro
4 Replies

3. Solaris

Solaris sftp throttling?

I get poor performance when sftp'ing a file to a server on a SunOS 5.10 system, with Sun_SSH_1.1.4. The same client performs much better to a linux system at the same site. From a TCPdump, it appears that the Solaris server is throttling the thruput. After proceeding normally for a while, the... (0 Replies)
Discussion started by: AGermain
0 Replies

4. Red Hat

Throttling a Yum Mirror sync

I'm building a yum mirror on Oracle Enterprise Linux, which is a fork of RHEL. I'm using uln-yum-mirror to create and maintain the mirror. In the Yum client, more specifically in /etc/yum.conf there is a throttle setting. Is there a like feature in /etc/sysconfig/uln-yum-mirror? If so, what is... (0 Replies)
Discussion started by: os2mac
0 Replies
uulog(1)						      General Commands Manual							  uulog(1)

NAME
uulog - display entries in the UUCP log file. SYNOPSIS
uulog [-#] [-n lines] [-sf system] [-u user] [-DSF] [--lines lines] [--system system] [--user user] [--debuglog] [--statslog] [--follow] [--follow=system] DESCRIPTION
The uulog program can be used to display entries in the UUCP log file. It can select the entries for a particular system or a particular user. You can use it to see what has happened to your queued jobs in the past. Different options may be used to select which parts of the file to display. OPTIONS
-#, -n lines, --lines lines Here '#' is a number; e.g., `-10'. The specified number of lines is displayed from the end of the log file. The default is to dis- play the entire log file, unless the -f, -F, or --follow options are used, in which case the default is to display 10 lines. -s system, --system system Display only log entries pertaining to the specified system. -u, --user user Display only log entries pertaining to the specified user. -D --debuglog Display the debugging log file. -S, --statslog Display the statistics log file. -F, --follow Keep displaying the log file forever, printing new lines as they are appended to the log file. -f system, --follow=system Keep displaying the log file forever, displaying only log entries pertaining to the specified system. Standard UUCP options: -X type, --debug type Turn on particular debugging types. The following types are recognized: abnormal, chat, handshake, uucp-proto, proto, port, config, spooldir, execute, incoming, outgoing. --debug option may appear multiple times. A number may also be given, which will turn on that many types from the foregoing list; for example, --debug 2 is equivalent to --debug abnormal,chat. -I file, --config Set configuration file to use. -v, --version Report version information and exit. --help Print a help message and exit. SEE ALSO
uucp(1) AUTHOR
Ian Lance Taylor <ian@airs.com>. Text for this Manpage comes from Taylor UUCP, version 1.07 Info documentation. Taylor UUCP 1.07 uulog(1)
All times are GMT -4. The time now is 06:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy