summaryrefslogtreecommitdiff
path: root/src/randsleep.1
blob: 41d2fac43045735508223d1e245312c3948a40dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.Dd July 06, 2011
.Dt RANDSLEEP 1
.Os
.
.
.Sh NAME
.
.Nm randsleep
.Nd Execute program after sleeping for a random time
.
.
.Sh SYNOPSIS
.
.Nm
.Ar time command args ...
.
.
.Sh VERSION
.
This manual documents
.Nm
version 0.0
.
.
.Sh DESCRIPTION
.
.Nm
executes
.Ar command
after sleeping for up to
.Ar time
seconds.
It is intended for use in cronjobs and similar.
.
.
.Sh RATIONALE
.
.Qq sleep $(( RANDOM % 120 )); do_stuff
and similar constructs are frequently used in crontab entries to decrease load
spikes when several entries are executed at the same time.
.
.Pp
.
However, in certain shells
.Pq such as Cm dash
.Ev $RANDOM
may not be available.
This leads to workarounds involving, for
example, /dev/urandom and cksum.  Since repeating the same workarounds over
and over seems somewhat pointless, this tool was created.
.
.
.Sh AUTHOR
.
Copyright (C) 2011 Daniel Friesel
.Aq derf@finalrewind.org .
.
.
.Sh LICENSE
.
You just DO WHAT THE FUCK YOU WANT TO.