This is a discussion on Startup script, Solaris 8 can't find 'source' command within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> This script works fine if the OS is up and running, but if I reboot the machine I get ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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, but don't know how to fix it. Any ideas? Thanks in advance. |
| |||
| >> On 18 Aug 2003 09:08:48 -0700, >> scwoodal@hotmail.com (Dj) said: > 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, > but don't know how to fix it. Any ideas? Thanks in > advance. Solaris runs scripts in the rc?.d directories through /sbin/sh. The Solaris FAQ covers this (somewhat incidentally): http://www.science.uva.nl/pub/solari...is2.html#q3.19 hth t |
| |||
| 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 |
| |||
| scwoodal@hotmail.com (Dj) writes: > >The file I'm trying to source has things like "setenv" in it, and I >don't think if it runs as /bin/sh it will understand the setenv. > That's right. You need to do something other than make the first line '#!/bin/csh' if you want your script run by csh instead of sh. -Greg -- Do NOT reply via e-mail. Reply in the newsgroup. |
| |||
| In article <8fd15dbf.0308181313.8de65f7@posting.google.com> , Dj <scwoodal@hotmail.com> wrote: >Tony Walton <tony.walton@s-u-n.com> wrote in message news:<3F40FBF3.6000109@s-u-n.com>... >> 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, >> >The file I'm trying to source has things like "setenv" in it, and I >don't think if it runs as /bin/sh it will understand the setenv. New >to Sun administration so please bare with me. That script you wrote at >the end of your post makes little to no sense for me. Well this might do it. 1. cp .main_source to .main_source.sh 2. edit .main_source.sh changing lines like setenv FOO BAR to two lines like (no spaces on either side of the ='s) FOO=BAR export FOO 3. Change your script to # note the beginning dot on the next line, the dot is like source .. /usr/appenv/.main_source.sh /usr/bin/su cindly -c "/ccm/Beta/is/procedures/bloomberg/Start_Blg_Servers.pl" -- http://www.math.fsu.edu/~bellenot bellenot <At/> math.fsu.edu +1.850.644.7189 (4053fax) |
| ||||
| Dj wrote: > Tony Walton <tony.walton@s-u-n.com> wrote in message news:<3F40FBF3.6000109@s-u-n.com>... >> >>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 > > > The file I'm trying to source has things like "setenv" in it, and I > don't think if it runs as /bin/sh it will understand the setenv. Correct - it's a csh script. Either (preferably, IMHO) re-write it as a Bourne shell script, or, as I suggested, create a Bourne shell script which runs your csh script and place that Bourne shell script in /etc/rcwhatever.d New > to Sun administration so please bare with me. That script you wrote at > the end of your post makes little to no sense for me. Can I suggest you find out quite a lot more about shell programming and system administration before you do *anything* else while logged in as root? Regards -- Tony |