Typo
[linux_from_scratch_hints.git] / OLD / at-daemon.txt
blob6a1edc0f21fda9e9eaa66e5f462c554941a37c88
1 TITLE:          How to install and configure at and the cron-daemon
2 LFS VERSION:    Any
3 AUTHOR:         Wolfgang Arendt <wolare@gmx.de>
5 SYNOPSIS:
6         How to install and configure at and the cron-daemon
8 HINT:
9 Contents
11      * Introduction
12      * Prerequisites
13      * Installing fcron
14      * Where to get fcron
15      * Building fcron
16      * Bootscript for cron
17      * Installing at
18      * Where to get at
19      * Building at
20      * Configuration
21      * Possible problems:
22      * Other implementations of cron
23        
24 Introduction
26    cron and at are two different programs that allow to execute jobs at
27    different times. cron was originally written by Paul Vixie and it's
28    primary use is, to run jobs, that need to be executed regularly. at
29    was written by Thomas Koenig and it can be used for executing programs
30    once at a given time. For example, you use cron in order to clean up
31    the /tmp/-directory every thursday night, while you would typically
32    use at in order to start a backup-process tonight at midnight.
33    
34    This hint tells you, how to install fcron, a replacement for the
35    original Vixie-cron, written by Thibault Godouet, along with the
36    original at-program. Installing fcron is easy and straightforward,
37    installing at is not that hard either, but it needs a little work to
38    be done.
39    
40 Prerequisites
42    The cron-daemon will run as user cron and group cron, while at will
43    run as user daemon, with group daemon. If you do not have those groups
44    and users, please create them before you proceed.
45    
46    You can run the daemons as different users but in that case you might
47    have to change some defaults when configuring the code later on.
48    
49 Installing fcron
51    We will not install the original cron but a replacement, called fcron.
52    cron is a very old program and it has not been maintainded for a very
53    long time. If you still feel like installing it, you can find a
54    download-location for the original program at the bottom of this
55    document along with download locations for several other
56    cron-programs.
57    
58   Where to get fcron
59   
60    You can get fcron from one of the many sunsite-mirrors or from
61    http://fcron.free.fr.
62    
63   Building fcron
64   
65    After unpacking the distribution and entering it's top level
66    directory, compiling and installing goes with:
67     ./configure --prefix=/usr \
68     --with-username=cron \
69     --with-groupname=cron \
70     --with-answer-all=no &&
71     make &&
72     make install &&
73     cd /usr/sbin &&
74     ln -s fcron cron &&
75     cd /usr/bin &&
76     ln -s fcrontab crontab
78    This installs fcron into /usr/sbin and creates a link to
79    /usr/sbin/cron as well as it installs fcrontab into /usr/bin and makes
80    a symbolic link to /usr/bin/crontab.
81    
82    cron is the daemon while crontab is being used in order to alter the
83    tables, that tell cron when to run a job.
84    
85    You can safely ignore the install-script's warnings about being unable
86    to create the boot-scripts, as we will create them now.
87    
88   Bootscript for cron
89   
90    Create a bootscript from the template /etc/init.d/template and link it
91    into the runlevel directories 2, 3, 4 and 5 for starting and into the
92    directories 0, 1 and 6 for killing.
93    
94    Do that by running something like this:
95     for rl in 0 1 6; do
96       cd /etc/rc$rl.d &&
97       ln -s ../init.d/cron K20cron
98     done
99     for rl in 2 3 4 5; do
100       cd /etc/rc$rl.d &&
101       ln -s ../init.d/cron S20cron
102     done
104    You should now be able to start cron by running
105     /etc/init.d/cron start
107 Installing at
109   Where to get at
110   
111    You can get the at-daemon from one of the many sunsite-mirrors around
112    the globe. I picked mine from here
113    ftp://ftp.LeidenUniv.nl/pub/linux/sunsite/system/daemons/
114    
115   Building at
116   
117    Enter the top-level-directory of the uncompressed package.
118    
119    First run ./Configure and pick your preferences. The defaults are
120    quite ok, only change the location for internal binaries from /usr/lib
121    to /usr/sbin and the location for the manual from /usr/man to
122    /usr/share/man.
123    
124    Then, all occurences of panic.h have to be removed from the files
125    at.c, panic.c and parsetime.c.
126    
127    You can either do this manually, or execute:
128     for i in at.c panic.c parsetime.c; do
129     mv $i $i.backup &&
130     cat $i.backup | sed -e '/panic\.h/d' > $i
131     done
133    After that run
134     make &&
135     make install
137   Configuration
138   
139    Create a cronjob for root, that calls atrun once in a minute. You
140    customize the cron-tables with the command
141      crontab -e
143    The entry, that has to be created should looks like this:
144      * * * * * /usr/sbin/atrun
146    That's it!
147    
148 Possible problems:
150    The group daemon or the user daemon does not exist (or both are
151    missing).
152    
153    Did you forget to create the cron-job, that calls atrun? (Do so by
154    running crontab -e)
155    
156    Check ownership of the spool-directories. They must be accessible for
157    the daemons.
158    
159 Other implementations of cron
161    Here are some sites, where you can get several implementations of
162    cron-daemons:
163    
164    after
165           http://www.ajk.tele.fi/~too/sw/after.readme
166           
167    anacron
168           http://anacron.sourceforge.net/
169           
170    dcron
171          http://www.ibiblio.org/pub/Linux/system/daemons/cron/dcron-2.3.3.tar.gz
172           
173    The original cron-daemon by Paul Vixie can be found here, along with
174    several of the formerly mentioned programs:
175    
176    cron
177           http://www.ibiblio.org/pub/Linux/system/daemons/cron/cron3.0pl1.tar.gz