source: trunk/athena/bin/desync/desync.1 @ 25706

Revision 25706, 3.8 KB checked in by kaduk, 12 years ago (diff)
Fix typo.
Line 
1.\" $Id: desync.8,v 1.3 2000-09-30 21:08:29 rbasch Exp $
2.\"
3.\" Copyright 1995, 1996, 1997 by the Massachusetts Institute of Technology.
4.\"
5.\" Permission to use, copy, modify, and distribute this
6.\" software and its documentation for any purpose and without
7.\" fee is hereby granted, provided that the above copyright
8.\" notice appear in all copies and that both that copyright
9.\" notice and this permission notice appear in supporting
10.\" documentation, and that the name of M.I.T. not be used in
11.\" advertising or publicity pertaining to distribution of the
12.\" software without specific, written prior permission.
13.\" M.I.T. makes no representations about the suitability of
14.\" this software for any purpose.  It is provided "as is"
15.\" without express or implied warranty.
16.\"
17.TH DESYNC 1 "3 August 2012"
18.SH NAME
19desync \- desynchronize timed jobs on networks
20.SH SYNOPSIS
21.B desync
22[
23.B \-t
24timefile ] [ range ]
25
26.B desync -c
27hours [ range ] [ other arguments ]
28.SH DESCRIPTION
29.I desync
30is a tool which sleeps a random (hostname seeded) period of time (up
31to an hour, by default) in order to skew the network load from several
32machines running
33.I cron
34jobs that would otherwise be synchronized.
35
36An invocation would appear something like
37
38.nf
39     42 * * * *          desync; /usr/lib/sendmail -q
40.fi
41
42in a crontab file.
43.SH OPTIONS
44.TP 8
45.B range
46This optional range specifies, in seconds, the maximum value for the
47randomly selected sleep time.  The default value is 3600.
48.TP 8
49.B \-h name
50Use
51.I name
52to seed the random number generator, instead of using the current host
53name.  This option is generally only useful in conjunction with the
54.B \-n
55option.
56.TP 8
57.B \-n
58Instead of sleeping, this option causes
59.I desync
60to write the number of seconds it would sleep to standard output, or,
61if the
62.B \-t
63option is also specified, the number of seconds remaining until the
64timer in
65.I timefile
66expires.
67.TP 8
68.B \-t timefile
69This option changes the behavior of
70.I desync
71to make it useful for desynchronizing jobs when sleeping is not
72appropriate.  If
73.I timefile
74does not exist,
75.I desync
76selects a random sleep time using the normal method, adds it to the
77current time value, writes the result into
78.IR timefile ,
79and exits with status 1.  If
80.I timefile
81does exist and the current time is less than the time value listed in
82.IR timefile ,
83then
84.I desync
85takes no action and exits with status 1.  If
86.I timefile
87exists and the current time is equal to or greater than the time value
88listed in
89.IR timefile ,
90then
91.I desync
92unlinks
93.I timefile
94and exits with status 0.  This feature can be used in shell code of
95the following form:
96
97.nf
98        if desync -t /tmp/mytimefile 3600; then
99                echo "Starting the job."
100        else
101                echo "Putting it off until later."
102        fi
103.fi
104
105.TP 8
106.B \-c hours
107This option changes the behavior of
108.I desync
109and causes it to generate output suitable for use in a crontab file.
110This is useful on modern Linux distributions, where sleeping for
111extended periods inside a cron job can confuse power management software
112or packages such as ConsoleKit, and running a cron job every 5 minutes
113to see if desync thinks it is "time to run" is undesirable.  Since
114desync will generate the same value each time on the same machine, it is
115fine to generate crontab files in a package's post-install script, for
116example.  In this mode, desync will output the crontab fields and then
117any additional arguments you supply.  So to generate a crontab with a
118randomized job, one might do something like this:
119
120.nf
121        for i in 2 4 8 14 20; do
122            desync -c $i 120 root /etc/athena/update_ws >> /etc/cron.d/update
123        done
124.fi
125
126
127.SH SEE ALSO
128cron(8)
129.SH AUTHOR
130Craig Fields, MIT Information Systems
131.br
132Greg Hudson, MIT Information Systems
133.br
134Debathena Project
135.br
136Copyright (c) 1995, 1996, 1997, 2012 Massachusetts Institute of Technology
Note: See TracBrowser for help on using the repository browser.