1836636 Members
1648 Online
110102 Solutions
New Discussion

crontab and error output

 
SOLVED
Go to solution
mick001
Advisor

crontab and error output

Hi all,

Can you please help met with the following problem?

I have to execute a script via the contab I have to use the. cshrc file and i want all output error to a file.

csh % command >> log 2>&1

Doesn't work I get the output of the. cshrc in the root mail box.

THANKS.
4 REPLIES 4
Chris Wilshaw
Honored Contributor
Solution

Re: crontab and error output

In the crontab line, you need to use

csh -c 'source .cshrc;command' >> log 2>&1

You'll need to give the full path for the .cshrc file and command.
Sanjay Kumar Suri
Honored Contributor

Re: crontab and error output

Check if you are able to execute without cron.

What is the exact entry in the crontab file?

Is cron running?

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
RAC_1
Honored Contributor

Re: crontab and error output

withour specifying any shell, all cron jobs will be executed with POSIX sehll(sh shell)

"/full_path_of .cshrc;command" Will do what you want.

make sure .cshrc is executable and have appropriate perms.
Also you can do as csh -c "source .cshrc;command"

Anil
There is no substitute to HARDWORK
mick001
Advisor

Re: crontab and error output

Thanks Chris!!
It works!!