Ask a Question related to Linux / Unix Administration, Design and Development.
-
Karan #1
Cron job doesn't work
Hi,
Can somebody please advise why the 1st cron's job (at 8 AM) doesn't
work whereby the 2nd cron's job (at 9 AM) is OK?
However, when I executed the 1st statement under command line, it
worked and created a file called 'maillog-20040716' at the required
directory.
00 8 * * 5 cp -p /var/log/maillog /test/maillog-`date +%Y%m%d`
00 9 * * 5 cp -p /var/log/maillog /test/maillog
Regards,
Karan Guest
-
cron job
If the cron job run every 15 minute, it will fill up mail box. Does anyone has any idea. Thanks "Davide Bianchi" <davideyeahsure@onlyforfun.net>... -
rsh and cron
I have Ultra 60 with Solaris 2.6, and the rsh always work fine, until recently I foud the rsh does not work on the Ultra 60. But I don't have any... -
Cron problems
Hi Floks when i am trying to run the following script it is getting executed but when iam tryint to execute thru corntab it is not?can any one... -
cron
Not specific to PHP really, but it all started with a simple PHP script I was automating... I've used cron/crontab on a zillion machines, and it... -
'LWP::UserAgent' and 'HTTP::Request' do not work during Cron Jobs
Hello. On a Linux machine, I've got a scheduled job (Cron Job): 17 * * * * perl /home/scripts/yahoo.pl Where 'yahoo.pl' is: ---... -
William Park #2
Re: Cron job doesn't work
Karan <ksc_lam02@yahoo.com> wrote:
/usr/bin/date> Hi,
> Can somebody please advise why the 1st cron's job (at 8 AM) doesn't
> work whereby the 2nd cron's job (at 9 AM) is OK?
>
> However, when I executed the 1st statement under command line, it
> worked and created a file called 'maillog-20040716' at the required
> directory.
>
> 00 8 * * 5 cp -p /var/log/maillog /test/maillog-`date +%Y%m%d`
> 00 9 * * 5 cp -p /var/log/maillog /test/maillog
--
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Toronto, Ontario, Canada
William Park Guest
-
Lew Pitcher #3
Re: Cron job doesn't work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Karan wrote:With the clues you've given, I'd have to say your problem relates to the PATH> Hi,
> Can somebody please advise why the 1st cron's job (at 8 AM) doesn't
> work whereby the 2nd cron's job (at 9 AM) is OK?
>
> However, when I executed the 1st statement under command line, it
> worked and created a file called 'maillog-20040716' at the required
> directory.
>
> 00 8 * * 5 cp -p /var/log/maillog /test/maillog-`date +%Y%m%d`
> 00 9 * * 5 cp -p /var/log/maillog /test/maillog
environment variable.
1) the cron job that uses a PATH-qualified date binary fails, while the cron
job that uses only fully qualified names succeeds, and
2) when run from the commandline, the PATH-qualified command succeeds.
Change your 8AM job so that the date command is fully qualified, and try it
again.
- --
Lew Pitcher
Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 ([url]http://counter.li.org/[/url])
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - [url]http://enigmail.mozdev.org[/url]
iD8DBQFBAe3pagVFX4UWr64RArzQAKC264mlGd4oah92GPNvJI a0puRVuACgxgTN
SmsHrkebe4b+/+k53uDOX3Y=
=bpjV
-----END PGP SIGNATURE-----
Lew Pitcher Guest
-
Bill Marcum #4
Re: Cron job doesn't work
On 23 Jul 2004 21:33:28 -0700, Karan
<ksc_lam02@yahoo.com> wrote:% sign needs to be escaped in crontabs.> Hi,
> Can somebody please advise why the 1st cron's job (at 8 AM) doesn't
> work whereby the 2nd cron's job (at 9 AM) is OK?
>
--
"Donna Hand of Ashburn, Va., waited five hours to see the casket and
spent about three minutes inside." --AP news story
Bill Marcum Guest
-
Goran Larsson #5
Re: Cron job doesn't work
In article <H3mMc.18976$Fj.779783@news20.bellglobal.com>,
Lew Pitcher <lpitcher@sympatico.ca> wrote:
Then how could cron find 'cp' but not 'date'?>> > 00 8 * * 5 cp -p /var/log/maillog /test/maillog-`date +%Y%m%d`
> > 00 9 * * 5 cp -p /var/log/maillog /test/maillog
> With the clues you've given, I'd have to say your problem relates to the PATH
> environment variable.
The problem is with the '%' character.
$ man crontab
. . .
The sixth field of a line in a crontab file is a string that
is executed by the shell at the specified times. A percent
character in this field (unless escaped by \) is translated
to a NEWLINE character.
Only the first line (up to a `%' or end of line) of the com-
mand field is executed by the shell. Other lines are made
available to the command as standard input. Any line begin-
ning with a `#' is a comment and will be ignored. The file
should not contain blank lines.
. . .
The correct fix is to change `date +%Y%m%d` to `date +\%Y\%m\%d`.
--
Göran Larsson [url]http://www.mitt-eget.com/[/url]
Goran Larsson Guest
-
Chris F.A. Johnson #6
Re: Cron job doesn't work
On 2004-07-24, Karan wrote:
The percent sign (%) is special to cron and must be escaped.> Hi,
> Can somebody please advise why the 1st cron's job (at 8 AM) doesn't
> work whereby the 2nd cron's job (at 9 AM) is OK?
>
> However, when I executed the 1st statement under command line, it
> worked and created a file called 'maillog-20040716' at the required
> directory.
>
> 00 8 * * 5 cp -p /var/log/maillog /test/maillog-`date +%Y%m%d`
> 00 9 * * 5 cp -p /var/log/maillog /test/maillog
man 5 crontab:
The ``sixth'' field (the rest of the line) specifies the command
to be run. The entire command portion of the line, up to a
newline or % character, will be executed by /bin/sh or by the
shell specified in the SHELL variable of the cronfile.
Percent-signs (%) in the command, unless escaped with backslash
(\), will be changed into newline characters, and all data after
the first % will be sent to the command as standard input.
The line should be:
00 8 * * 5 cp -p /var/log/maillog /test/maillog-`date +\%Y\%m\%d`
--
Chris F.A. Johnson [url]http://cfaj.freeshell.org/shell[/url]
================================================== =================
My code (if any) in this post is copyright 2004, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
Chris F.A. Johnson Guest
-
William Park #7
Re: Cron job doesn't work
Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
Which OS or Distro is that? My Slackware Linux has something different.> The percent sign (%) is special to cron and must be escaped.
>
> man 5 crontab:
>
> The ``sixth'' field (the rest of the line) specifies the command
> to be run. The entire command portion of the line, up to a
> newline or % character, will be executed by /bin/sh or by the
> shell specified in the SHELL variable of the cronfile.
> Percent-signs (%) in the command, unless escaped with backslash
> (\), will be changed into newline characters, and all data after
> the first % will be sent to the command as standard input.
--
William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
Toronto, Ontario, Canada
William Park Guest
-
Robert Melson #8
Re: Cron job doesn't work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Saturday 24 July 2004 19:53, William Park wrote:
Can't speak for Chris, but a quick look at the crontab manpage on my> Chris F.A. Johnson <cfajohnson@gmail.com> wrote:>>> The percent sign (%) is special to cron and must be escaped.
>>
>> man 5 crontab:
>>
>> The ``sixth'' field (the rest of the line) specifies the command
>> to be run. The entire command portion of the line, up to a
>> newline or % character, will be executed by /bin/sh or by the
>> shell specified in the SHELL variable of the cronfile.
>> Percent-signs (%) in the command, unless escaped with backslash
>> (\), will be changed into newline characters, and all data after
>> the first % will be sent to the command as standard input.
> Which OS or Distro is that? My Slackware Linux has something
> different.
>
> --
> William Park, Open Geometry Consulting, <opengeometry@yahoo.ca>
> Toronto, Ontario, Canada
FreeBSD system shows almost identical wording. As well, I see the same
thing on a Solaris system to which I have access.
Bob
- --
Robert G. Melson Nothing is more terrible than
Rio Grande MicroSolutions ignorance in action.
El Paso, Texas Goethe
melsonr(at)earthlink(dot)net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQFBAxj7GX60pjRVDrMRAueqAKCwzTfCOGqEXeefKuxZ73 tgVkFQXACg2JAL
NxrPGFj3zmMrbGpmyNicUA0=
=uK1d
-----END PGP SIGNATURE-----
Robert Melson Guest
-
Barry Margolin #9
Re: Cron job doesn't work
In article <2mgi41Fmhp93U1@uni-berlin.de>,
William Park <opengeometry@yahoo.ca> wrote:
That feature of the % in cron has been around since long before Linux.> Chris F.A. Johnson <cfajohnson@gmail.com> wrote:>> > The percent sign (%) is special to cron and must be escaped.
> >
> > man 5 crontab:
> >
> > The ``sixth'' field (the rest of the line) specifies the command
> > to be run. The entire command portion of the line, up to a
> > newline or % character, will be executed by /bin/sh or by the
> > shell specified in the SHELL variable of the cronfile.
> > Percent-signs (%) in the command, unless escaped with backslash
> > (\), will be changed into newline characters, and all data after
> > the first % will be sent to the command as standard input.
> Which OS or Distro is that? My Slackware Linux has something different.
--
Barry Margolin, [email]barmar@alum.mit.edu[/email]
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Barry Margolin Guest
-
Moe Trin #10
Re: Cron job doesn't work
In article <2mgi41Fmhp93U1@uni-berlin.de>, William Park wrote:
>Chris F.A. Johnson <cfajohnson@gmail.com> wrote:>> The percent sign (%) is special to cron and must be escaped.
>>
>> man 5 crontab:Which cron daemon are you using? In Dead Rat Linux, and most versions>Which OS or Distro is that? My Slackware Linux has something different.
of Unix, it's Vixie-cron, and my man page is identical. The man page seems
to be quite old, as the bottom reads
AUTHOR
Paul Vixie <paul@vix.com>
24 January 1994
Looking at the package list from Slack90, I see
PACKAGE DESCRIPTION:
dcron: dcron (Dillon's Cron daemon)
dcron:
dcron: The cron daemon runs in the background and executes tasks on behalf of
dcron: users at the appropriate time. Many timed system tasks are started
dcron: with cron, such as the nightly indexing with updatedb.
dcron:
dcron: dcron was written entirely from scratch by Matthew Dillon.
dcron:
Can you say Apples and Oranges?
Old guy
Moe Trin Guest



Reply With Quote

