Cron and forcing the use of ksh - FOLLOWUP

From: James S. Siojo (jsiojo@sabiosolutions.com)
Date: Thu Jan 16 2003 - 19:48:00 EST


First of all thanks to all that have taken the time to respond.
 Unfortunately, I don't think I explained myself very well. I received
about 30 responses. More than 20 of them mentioned placing #!/bin/ksh on
the first line of my script should solve the problem. I suppose I
should have mentioned that all of my scripts already have the
#!/bin/ksh on the first line. I have taken various steps to solve this
problem without using my last ditch resort of this wonderful list. I
have also tried multiple variations of:

1 10 * * * /bin/ksh script.sh

and haven't had much luck.

This problem only occurs when I execute the script from the crontab.
 When executed from the shell prompt (korn) the script works perfectly.
 This problem started to occur when we performed a migration from
Solaris 6 to Solaris 8. Should I set the default system shell to korn
instead of bash? What could be the side effects of doing such a thing?

The #!/bin/ksh command at the top of my scripts apparently aren't doing
anything since I have a trace program that tells me the values of all my
environment variables and writes them to a file. When the script is
executed from cron I get output that says

SHELL is /bin/ksh

When I run the script from cron I get output that says

SHELL is /usr/bin/sh

Is there something different in Solaris 8 in comparison with Solaris 6
in terms of how it handles cron jobs?

Any help would be extremely appreciated. I am getting desperate with
this problem and can't seem to find an answer anywhere.

Thanks in advance.

- James

James S. Siojo wrote:

> Hi All,
>
> I have determined that the reason various scripts are failing when run
> in cron is because cron uses /bin/sh instead of /bin/ksh to execute
> the scripts. Sourcing the .profile in the crontab only sets the
> environment variables but does nothing to set the shell. How do I
> force the use of the korn shell for running cron jobs. The user that
> is executing the cron jobs has the korn shell as its' default but cron
> insists on NOT using the korn shell.
>
> Please help.
>
> Will summarize.
>
> Thanks in advance.
>
> - James
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:25:36 EDT