rcX.d scripts in Solaris 10 - where does the output go?

I'm trying to debug my startup scripts in rc2.d and rc3.d - during boot the system prints nothing to the console. Where does the output (stdout, stderr) from the scripts go?

The scripts do run, I know that,

Thanks,

-w

[307 byte] By [wsanders1] at [2007-11-25 22:36:09]
# 1

take a look in /var/svc/log/

This is the area where all of the starup services/scripts put their output.

For the old style rc scripts you want to lookin the milestone logs:

rc2.d goes to milestone-multi-user:default.log

rc3.d goes to milestone-multi-user-server:default.log

a tail -f on these is pretty useful at boot time, since your the login prompt appears (and sshd comes up) before most of the rc2 and rc3 scripts run.

Therus at 2007-7-5 14:01:47 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2

Thanks, to be a bit more specific, one of my favorite ways to debug startup scripts in the past was to place a "#!/bin/sh -x" in the first line fo the script so I could see everything happen. It appears that this output doesn't seem to be captured anywhere in the Solaris 10 boot process.

Output going to stderr and stdout by way of an echo statement seems to be captured, I created a file /etc/rc2.d/S99outputfoo that looks like this:

#!/bin/sh -x

echo I AM A JELLY DONUT TO STDOUT

echo I AM A JELLY DONUT TO STDERR >&2

echo I AM A JELLY DONUT TO DEVNULL >/dev/null

Which IIRC sends the second line to stderr, just to check to see if it was a matter of svc sending stderr to the bit bucket. But all I see in milestone-multi-user:default.log is:

Executing legacy init script "/etc/rc2.d/S99outputfoo".

I AM A JELLY DONUT TO STDOUT

I AM A JELLY DONUT TO STDERR

Legacy init script "/etc/rc2.d/S99outputfoo" exited with return code 0.

I expect to see something like:

+ echo I AM A JELLY DONUT TO STDOUT

I AM A JELLY DONUT TO STDOUT

+ echo I AM A JELLY DONUT TO STDERR

I AM A JELLY DONUT TO STDERR

+ echo I AM A JELLY DONUT TO DEVNULL

wsanders1 at 2007-7-5 14:01:47 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3

This might sounds bonkers (as it should do the same thing) but try this:

instead of:

#!/bin/sh -x

try:

#!/bin/sh

set -x

This has worked for me in the past.

Otherwise i've used newctty (to get round Sun bug number 1143634 - using response files in rc scripts), however it also sends the ouput back to the console again, as before:

<a href="http://www.lunanbay.co.uk/software/c/" target="_blank">http://www.lunanbay.co.uk/software/c/</a>

I'm not sure if i still need newctty for Solaris 10 (for the pkgadd bug).

Rich

Therus at 2007-7-5 14:01:47 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4

Executing legacy init script "/etc/rc2.d/S99outputfoo".

+ echo I AM A JELLY DONUT TO STDOUT

I AM A JELLY DONUT TO STDOUT

+ echo I AM A JELLY DONUT TO STDERR

I AM A JELLY DONUT TO STDERR

+ echo I AM A JELLY DONUT TO DEVNULL

Legacy init script "/etc/rc2.d/S99outputfoo" exited with return code 0.

BTW I also seem to have heard there is a verbose output option to smf. I'm sure it's buried somewhere in the documentation.

All hail sh trivia experts - stop by the office next time you're in San Franscisco and I'll buy you a beverage.

-w

# cat S99outputfoo

#!/bin/sh

set -x

echo I AM A JELLY DONUT TO STDOUT

echo I AM A JELLY DONUT TO STDERR >&2

echo I AM A JELLY DONUT TO DEVNULL >/dev/null

wsanders1 at 2007-7-5 14:01:47 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...