ALT Linux Bugzilla
– Attachment 2202 Details for
Bug 3193
[FR] [5.0] (ana)cron'ed jobs could behave better
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
load-sensitive cronjob wrapper
relax (text/plain), 813 bytes, created by
Michael Shigorin
on 2007-09-17 19:25:45 MSD
(
hide
)
Description:
load-sensitive cronjob wrapper
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2007-09-17 19:25:45 MSD
Size:
813 bytes
patch
obsolete
>#!/bin/sh ># A tiny wrapper to let cron run jobs (like slocate) with a respect ># to the system load. Written by <michael.shigorin@usa.net> > >LOAD=0.5 # -l: the default critical load value >TIME=2 # -t: 1 for the very last minute, 2 => 5 min, 3 => 15 min >ONCE=0 # -o: once per day > >while : >do > case $1 in > -l|--load) LOAD=$2; shift; shift; continue;; > -t|--time) TIME=$2; shift; shift; continue;; > -o|--once) ONCE=1; shift; continue;; > -h|--help) head -l 6 "$0"; exit 0;; > *) break;; > esac >done >LOAD=$(echo "100*$LOAD"|bc) >LOAD=${LOAD%.*} >NOW=$(echo "100*`/usr/bin/cut -f$TIME -d' ' /proc/loadavg`"|bc) >NOW=${NOW%.*} >[ "$(/bin/ls -l --time=use "$1"|/usr/bin/cut -c43-48)" = \ > "$(/bin/date +"%b %d")" ] && exit 0 # $1 already used today > # (maybe not by us :-/ ) >[ $NOW -le $LOAD ] && eval $* >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3193
: 2202