68 lines
2.0 KiB
HTML
68 lines
2.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE>PATH HOWTO: Delayed commands cron and at</TITLE>
|
|
<LINK HREF="Path-11.html" REL=next>
|
|
<LINK HREF="Path-9.html" REL=previous>
|
|
<LINK HREF="Path.html#toc10" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="Path-11.html">Next</A>
|
|
<A HREF="Path-9.html">Previous</A>
|
|
<A HREF="Path.html#toc10">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s10">10. Delayed commands cron and at</A></H2>
|
|
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss10.1">10.1 cron</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Cron is a command that executes commands periodically as specified in
|
|
/etc/crontab and user-defined crontabs. In Debian 1.3 there is a
|
|
standard mechanism to execute commands in /etc/cron.daily,
|
|
/etc/cron.weekly and /etc/cron.monthly.
|
|
<P>Cron is started from boot scripts but it seems to change it's PATH to
|
|
a pretty strange one:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
/usr/bin:/binn:/sbin:/bin:/usr/sbin:/usr/bin
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>THIS IS LIKELY A BUG IN CRON. This is the init path where there is
|
|
/usr/bin:/bin written over the beginning without terminating 0! This
|
|
bug does not exist in all the systems.
|
|
<P>In crontab there can be PATH definition. In Debian 1.3 there is
|
|
the following default line in the beginning of /etc/crontab:
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
<P>Because of this, the PATH of crond program is never used in user
|
|
programs. All the scripts in /etc/cron.* directories get this path by
|
|
default. This path is used even if a program is executed as non-root.
|
|
<P>
|
|
<P>
|
|
<H2><A NAME="ss10.2">10.2 at</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>at is a command that can be used to run a one-time program at specific
|
|
time.
|
|
<P>atd is run using init path. However, the user programs are always run
|
|
in the user environment using sh command. Therefore the usual shell
|
|
overwrites apply. Look the chapter on bash.
|
|
<P>
|
|
<P>
|
|
<HR>
|
|
<A HREF="Path-11.html">Next</A>
|
|
<A HREF="Path-9.html">Previous</A>
|
|
<A HREF="Path.html#toc10">Contents</A>
|
|
</BODY>
|
|
</HTML>
|