Script behaving differently in Crontab..

Hi,

I wrote a script to stop a process,truncate its log files and re-start the process...
We are using Progress Software in Unix ( Sun Sparc)

When ever I start this progress program , it should kick off a C pgm in the background..
The script work perfectly fine when I run it from command prompt..
When I scheduled it from crontab, the stopping and truncating log files works fine..
When it starts of the progress program, that time also it looks OK..
But when I do (ps -ef ) for that C program, I found two instances of the C program running.. One is the actual C program which I wanted it to run and other is the same C program with slightly different process name...
> ps -ef | grep 'myprocess'
admin1 .......... myprocess
admin1 .......... usr/bin/sh -C myprocess

Also, the second process is the parent for first process...
Any ideas why it is working differently in crontab ??
If my explanation is not clear, let me know... I could post some screen dumps which might explain more...

Thanks in advance,

I believe you are seeing what you are because crontab always (best I can tell runs in sh shell).

Thus it's not 2 processes running it's crontab starting the sh shell,

check who is the parent of:

admin1 .......... usr/bin/sh -C myprocess

and then your script being run in the sh shell:

admin1 .......... myprocess

The crontab scripts I run always do this. The only real problem is when you don't want you script ran in the sh shell. the following line put as the 1st line of your script can change the shell but I find it not an execate science...

#!usr/bin/SHELL_YOU_WNAT_TO_RUN_IN

ps even if you do this you will get the:

admin1 .......... usr/bin/sh -C myprocess

Thanks a lot..
I was under the impression that two instances are running..
looks like it is not..
should be OK to run sh shell itself...

Please navigate:
www.unix.com home page -> Answers to Frequently Asked Questions -> cron and crontab

and scroll down to: It works from the command line but not in crontab

Yeah.
After seeing your reply on other forum , I checked the posting "Cron and Crontab" and it helped me a lot..

If the process did not run from crontab, I would have thought it has something to do with environment variables or shell..
In my case, I was seeing two listings of same processes when I run it from Crontab.. Now, it is clear that one is not actually a process ( just kicked off by cron)..

Anyways, Thanks for the help and I'll make sure to follow the forum rules...