View Single Post

   
  #3 (permalink)  
Old 01-12-2008, 06:23 AM
Tony Walton
 
Posts: n/a
Default Re: Startup script, Solaris 8 can't find 'source' command

Dj wrote:
> This script works fine if the OS is up and running, but if I reboot
> the machine I get an error saying that 'source not found.'
>
> Here's my script:
>
> #!/bin/csh
> source /usr/appenv/.main_source
> /usr/bin/su cindly -c
> "/ccm/Beta/is/procedures/bloomberg/Start_Blg_Servers.pl"
>
> I understand that it can't find the 'source' command,


Which is a csh builtin

> but don't know
> how to fix it. Any ideas? Thanks in advance.




Startup scripts (assuming you mean a startup script in /etc/init.d and
/etc/rc?.d) should be Bourne shell scripts. The script that runs them
(/etc/rc3 for instance) passes the script to /sbin/sh unless the script
name ends with .sh (in which case it "dots" it - the Bourne/Korn version
of sourcing it) without passing it to /bin/sh).

for f in /etc/rc3.d/S*; do
if [ -s $f ]; then
case $f in
*.sh) . $f ;;
*) /sbin/sh $f start ;;
esac
fi
done
fi



If you really, really need a csh startup script (and I'm pretty much at
a loss to imagine why you would), write a Bourne shell script that runs
it (a wrapper) and put the Bourne shell script in /etc/rcwhatever.d

--
Tony

Reply With Quote