[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [BAD] the whole server down with a red-alert-like attack



On Thu, 24 Jan 2002 22:16, Radek Hnilica wrote:
> I made the same experience with some testing script on one of my
> routers.  I run that script from cron to often.  When the conditions
> were good, the one run end before cron run the next.  But once the
[...]
> I resolved my problem with not running that script every minute but
> relax rules and run it vere five or ten munites.

IMHO something that runs every minute should not be in cron, even something 
that runs every 5 minutes possibly shouldn't be in cron.

A shell script that does the following should do:
#!/bin/sh

while /bin/true ; do
  /usr/local/bin/something
  sleep 60
done

So if the script takes hardly any time to run then it runs every minute.  If 
it takes a lot of resources then it'll run only one copy at a time, and have 
a 1 minute break between runs (time for other programs to get some CPU time 
etc).

What would be handy would be to have a program that did all this, so I could 
do:

/usr/bin/runevery 60seconds /usr/local/bin/something

To get the same result as the above shell script.

Then for even more protection it could have options to monitor and/or limit 
CPU usage and log to syslog.

Does this sound good?  If I get a dozen people sending me private email 
stating that they want to use such a program then I'll write it and add it to 
my logtools package.

-- 
http://www.coker.com.au/bonnie++/     Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/       Postal SMTP/POP benchmark
http://www.coker.com.au/projects.html Projects I am working on
http://www.coker.com.au/~russell/     My home page



Reply to: