Cron execution of shell script

Hi Guys,
Unable to run this script from the cron,although the same executes perfectly from the command line.Please help.

#!/bin/sh

#### aprintd alarm creation files #####

file=\`date \+%m%d%Y\`
pid=$$
echo "$pid"
/u01/app/netboss/bin/aprintd/aprintd > $file &
childpid=$!
echo "$childpid"
while .
do
			
	time=\`date \+%H%M%S\`		
	if [ $time -eq 050000 ]
	then					
		kill $childpid
	        echo "if loop"
		kill $pid				
	fi
done

Hi there...

Normally when you can't execute a script in cron and manually ok the problem is the envroment variables....

Try to insert in the script:
export PATH=.........

or if .profile has the correct PATH execute it in the script.

I think you meant while :, not while .?

Btw: There is a search function here in the forum and if you use patterns like "cron" and "script" you get a lot of close hits. Also if you have errors to show us, please post them too.

Source your neeed environment files like for example ".profile" in the head of the script because when it's running under cron, they will not be used automatically. Also you might use absolute paths if something is not found.

Example:

. ~myuser/.profile
...yourscript comes here....