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

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