Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange behaviour of cron

5 views
Skip to first unread message

Friedhelm Neyer

unread,
Oct 30, 2009, 2:25:51 PM10/30/09
to
Hi together

maybe it's only a syntax error, but the following find runs fine on
commandline but when starting via cron, it fails

find /dir/dir/dir/ -name file -mtime +2 -exec mv {} /dir/dir/dir/file \;

What is wrong here?

Thx in advance
Friedhelm

Blazej Antczak

unread,
Oct 30, 2009, 6:05:41 PM10/30/09
to
Friedhelm Neyer pisze:

> Hi together
>
> maybe it's only a syntax error, but the following find runs fine on
> commandline but when starting via cron, it fails
>
> find /dir/dir/dir/ -name file -mtime +2 -exec mv {} /dir/dir/dir/file \;
>
^^^^^^^^^^^^^^^^^
what you need that
for? Will work without this as well.

Did you using find with absolute path in cron's script? Put into your
script verbosity (like set -x as second line --> depends from shell).
Log std output and error from this command from cron to some file(s).
Maybe this can point you where error is.

Rgrds,
Blazej

Friedhelm Neyer

unread,
Oct 31, 2009, 6:51:17 AM10/31/09
to
Blazej Antczak schrieb:

What I want to do is to identify a specific logfile in my homedir, which
will be written every day. To prevent myhome from going out of space I
want to move the logfile, which is older than two days, to another,
bigger directory. So I try to identify the file and move it to another
place. For example

find /my/home -name logfile -mtime +2 exec mv {} \; ???????
==> which syntax to move /my/home/logfile to another dir

Hajo Ehlers

unread,
Nov 2, 2009, 5:39:38 AM11/2/09
to
On Oct 30, 7:25 pm, Friedhelm Neyer <Friedhelm.Ne...@t-online.de>
wrote:
You must escape the \

find /dir/dir/dir/ -name file -mtime +2 -exec mv {} /dir/dir/dir/file \
\;

hth
Hajo

0 new messages