Computing.Net > Forums > Unix > cronjobs problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

cronjobs problem

Reply to Message Icon

Name: pass
Date: March 29, 2003 at 00:08:21 Pacific
OS: UNIX
CPU/Ram: SUN
Comment:

hi all, I want to execute this script in cronjobs but it doesn't work. If I execute it directly it work well
how can it be happend ?

...
n=$(ls|wc-l)
print $n > test
...



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: March 29, 2003 at 08:55:24 Pacific
Reply:

Pass:

Typically, when a shell script works from the command line, but not from cron, it's because one or more of the utilities/programs being called can't be found.

Place your PATH declaration (or any other shell variables you are using)in the script. That should fix your problem.

Regards,

Nails



0

Response Number 2
Name: pass
Date: March 29, 2003 at 17:18:19 Pacific
Reply:

Hi Nails

I already put
#!/usr/bin/ksh
in the top of my script, it should call ksh, is it?
or is there any path that I have missed ?

thanks

pass



0

Response Number 3
Name: WilliamRobertson
Date: March 30, 2003 at 15:02:41 Pacific
Reply:

What doesn't work exactly?


0

Response Number 4
Name: pass
Date: March 31, 2003 at 17:04:10 Pacific
Reply:

hi,
I want to put myscript in cron, but it doesn't work correctly.
I have trace that

n=$(ls|wc-l)
print $n > test

is real the problem. this command didn't work while it run in cron ( this command is in my shell script ).

I have call ksh in cron but it still not work correctlly.

3 * * * * /bin/ksh -c "/export/home/file.sh"

already call it in my script using
#! /bin/ksh ,and change my profile at /etc/passwd into ksh

all I did still doesn't work correctly

how to solve that ...?



0

Response Number 5
Name: WilliamRobertson
Date: April 1, 2003 at 02:18:27 Pacific
Reply:

Have you confirmed that it's in the expected directory when it does the 'ls'?

Is it your cron job, or the superuser's? Does the script run from the command line if you log in as root?

What output/errors do you get?


0

Related Posts

See More



Response Number 6
Name: pass
Date: April 1, 2003 at 23:52:48 Pacific
Reply:

I'm sure that is in expected directory. I already run it as super user or just as the user ( in cron jobs ) and it is not working but while I run all my shell using command line it working properlly.

while I run my shell using cronjobs there was no output there. so it will affect all the result.
I have faced this conditions before but I can solve it using rsh that I put in cronjobs from other unix pc so it looks like shell was run using command line by other PC.

So what do you think about it ?

thanks


0
Reply to Message Icon

Emergency Boot Floppy How to call a java progra...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: cronjobs problem

Crontab Problems !!!! www.computing.net/answers/unix/crontab-problems-/3420.html

Help: problems installing 9 gig hd in SCO UNIX 3.2v4 www.computing.net/answers/unix/help-problems-installing-9-gig-hd-in-sco-unix-32v4/1648.html

FTP File Size Problem from UNIX to www.computing.net/answers/unix/ftp-file-size-problem-from-unix-to/4240.html