Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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
...

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

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

hi,
I want to put myscript in cron, but it doesn't work correctly.
I have trace thatn=$(ls|wc-l)
print $n > testis 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 kshall I did still doesn't work correctly
how to solve that ...?

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?

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

![]() |
Emergency Boot Floppy
|
How to call a java progra...
|

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