OpenVZ Forum


Home » Mailing lists » Users » Reduce Load in VZs
Re: [PATCH] Reduce Load in VZs - stop cron.d thundering herd... [message #43172 is a reply to message #43170] Wed, 03 August 2011 08:29 Go to previous messageGo to previous message
Tim Small is currently offline  Tim Small
Messages: 24
Registered: April 2011
Junior Member
On 03/08/11 08:47, Kir Kolyshkin wrote:
>
> (3) CT has a distro installed which has crontab in some unusual location

Nearly (3)

/etc/cron.d is a standard location, but vps-postcreate.sh didn't deal
with it.

I thought I'd submitted this patch to debian, but I seem to have dropped
it :-(

Tim.

--- postcreate.sh.old 2010-09-14 06:07:31.000000000 +0100
+++ /etc/vz/dists/scripts/postcreate.sh 2011-08-03 09:27:22.490356610 +0100
@@ -24,12 +24,12 @@

function randcrontab()
{
- file=${VE_ROOT}"/etc/crontab"
+ for file in ${VE_ROOT}/etc/cron.d/* ${VE_ROOT}/etc/crontab
+ do
+ [ -f "${file}" ] || return 0

- [ -f "${file}" ] || return 0
-
- /bin/cp -fp ${file} ${file}.$$
- cat ${file} | awk '
+ /bin/cp -fp ${file} ${file}.$$
+ cat ${file} | awk '
BEGIN { srand(); }
{
if ($0 ~ /^[ \t]*#/ || $0 ~ /^[ \t]+*$/) {
@@ -61,8 +61,9 @@
}
print line;
}
-' > ${file}.$$ && /bin/mv -f ${file}.$$ ${file}
- /bin/rm -f ${file}.$$ 2>/dev/null
+ ' > ${file}.$$ && /bin/mv -f ${file}.$$ ${file}
+ /bin/rm -f ${file}.$$ 2>/dev/null
+ done
}

function disableroot()





--
South East Open Source Solutions Limited
Registered in England and Wales with company number 06134732.
Registered Office: 2 Powell Gardens, Redhill, Surrey, RH1 1TQ
VAT number: 900 6633 53 http://seoss.co.uk/ +44-(0)1273-808309
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Puppet module for OpenVZ management
Next Topic: Question About /proc file system in VMs.
Goto Forum:
  


Current Time: Sat Aug 16 10:39:25 GMT 2025

Total time taken to generate the page: 0.19953 seconds