Another alternative in bash :
#!/bin/bash
# randomize /etc/crontab
test -f /var/backups/crontab-orig || cp /etc/crontab /var/backups/crontab-orig
SUM=`sum -s /etc/hostname | cut -d" " -f1`
H=$[ 6 - ( $RANDOM % 2 ) ]
M=`printf "%02d" $[ ( $SUM ) % 60 ] `
sed -i -e "s/^[0-9]*\(.*cron\.hourly.*\)/$M
# One-liner
perl -p -i -e 'if(/run-parts/) { s/^\d+/unpack("%32C*",qx{hostname -s})%60/e;
s/^([\d*]+\s+)\d+/$1.($.-8)/e; }' /etc/crontab
The above one-liner will randomize the minute and the hour of all "run-parts"
lines of /etc/crontab on Debian
I calculate the System V sum of the hostname mod
severity 373152 wishlist
merge 373152 522419
thanks
In my own experience, the only proper approach -- guaranteeing "safe"
system loads -- is a managed solution, ie either custom crontabs for the
guests or having cron jobs managed by the host (as Russell plans to do).
Nevertheless, I understand th
Package: cron
Version: 3.0pl1-86
Severity: normal
I'm using a setting with 6 virtual Debian servers.
All their system cronjobs start at the same time, which eats all the
ressources of the server at the same time (especially updatedb every
morning at 6:25). The servers all basically come to a hal
4 matches
Mail list logo