FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 08-22-2011, 09:13 AM
David
 
Default Cron script output redirection not working

Hi there.

This is something that used to work for me in older Debian releases
(Etch and Lenny I think), but it's no longer working for me in
Squeeze.

Basically, I have a cron stub under /etc/cron.d, with a line like this:

* * * * * root cd /tmp/ && ./test.sh &> ./test.log

And inside /tmp/test.sh I have these lines:

#!/bin/bash
echo "test"
touch test.touch

I've verified that the script is being run every minute from cron -
I'm seeing entries in /var/log/syslog, and also /tmp/test.touch is
being created.

However, the log file /tmp/test.log is never created.

Is it no longer possible to do output redirection to log files from
within crontab scripts? Or am I meant to use a different syntax these
days?

Regards,

David.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAKqfKYS9PaRZuxUTuDzQ=bSvOE-qpQqr=j5-kJUDmo8a+nuDCQ@mail.gmail.com">http://lists.debian.org/CAKqfKYS9PaRZuxUTuDzQ=bSvOE-qpQqr=j5-kJUDmo8a+nuDCQ@mail.gmail.com
 
Old 08-22-2011, 09:56 AM
Ivan Shmakov
 
Default Cron script output redirection not working

>>>>> David <wizzardx@gmail.com> writes:

> This is something that used to work for me in older Debian releases
> (Etch and Lenny I think), but it's no longer working for me in
> Squeeze.

> Basically, I have a cron stub under /etc/cron.d, with a line like
> this:

> * * * * * root cd /tmp/ && ./test.sh &> ./test.log

[…]

> However, the log file /tmp/test.log is never created.

> Is it no longer possible to do output redirection to log files from
> within crontab scripts? Or am I meant to use a different syntax these
> days?

I guess that it may be related to the recent switch from Bash to
Dash as /bin/sh, which doesn't seem to support &>.

If that's true, then changing it to, e. g., > ./test.log 2>&1
will probably solve the problem.

--
FSF associate member #7257 Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 86vctpsrb2.fsf@gray.siamics.net">http://lists.debian.org/86vctpsrb2.fsf@gray.siamics.net
 
Old 08-25-2011, 10:53 AM
David
 
Default Cron script output redirection not working

On Mon, Aug 22, 2011 at 11:56 AM, Ivan Shmakov <ivan@gray.siamics.net> wrote:
>
> * * * *I guess that it may be related to the recent switch from Bash to
> * * * *Dash as /bin/sh, which doesn't seem to support &>.
>
> * * * *If that's true, then changing it to, e. g., > ./test.log 2>&1
> * * * *will probably solve the problem.
>

Thanks, that works for me.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAKqfKYTVX1vzeZ4DNggMGACFziBiVH3tZ1bcsvE6Qc84wxc+W w@mail.gmail.com">http://lists.debian.org/CAKqfKYTVX1vzeZ4DNggMGACFziBiVH3tZ1bcsvE6Qc84wxc+W w@mail.gmail.com
 

Thread Tools




All times are GMT. The time now is 08:41 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org