[Users] [PATCH] Reduce Load in VZs - stop cron.d thundering herd...

me at free-minds.net me at free-minds.net
Wed Aug 3 04:33:54 EDT 2011


awesome thanks, i'll try it. So best is i copy all the stuff from
cron.daily to cron.d and add 0 0 * * * ar @daily at the beginning, or is it
the same to leave them there and these things will allready called by cron?

On Wed, 03 Aug 2011 09:29:32 +0100, Tim Small <tim at seoss.co.uk> wrote:
> 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()


More information about the Users mailing list