Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Starting and stopping legacy services via SMF?

3,012 views
Skip to first unread message

for...@gmail.com

unread,
Apr 26, 2011, 5:36:49 PM4/26/11
to
I installed CSWapache2 recently on one of my sparc systems (Solaris
10). After a while, it occurred to me the method I expected to stop
and start these services manually doesn't work:

# svcadm disable lrc:/etc/rc3_d/S50httpd
svcadm: Operation not supported for legacy service 'lrc:/etc/rc3_d/
S50httpd'

The script is in /lib/svc/method/http-apache2.

Of course, when you try to kill it off, SMF just keeps respawning.
I wonder if the method scripts are cached somewhere, as I made a
couple of changes and it they didn't seem to take place until after
the system was rebooted.

Looking around the internet, the docs I see don't talk much about
handling legacy services, just describing what they are.

So how do you manually stop and start a legacy service like this?


Thanks.

Ian Collins

unread,
Apr 26, 2011, 5:52:23 PM4/26/11
to
On 04/27/11 09:36 AM, for...@gmail.com wrote:
> I installed CSWapache2 recently on one of my sparc systems (Solaris
> 10).

Did you know Solaris 10 ships with Apache2? Last time I looked, the
CSWapache2 package had some notes on how to use it with SMF.

> After a while, it occurred to me the method I expected to stop
> and start these services manually doesn't work:
>
> # svcadm disable lrc:/etc/rc3_d/S50httpd
> svcadm: Operation not supported for legacy service 'lrc:/etc/rc3_d/
> S50httpd'
>
> The script is in /lib/svc/method/http-apache2.

This is the stock Solaris 10 Apache2 script.

> Of course, when you try to kill it off, SMF just keeps respawning.
> I wonder if the method scripts are cached somewhere, as I made a
> couple of changes and it they didn't seem to take place until after
> the system was rebooted.
>
> Looking around the internet, the docs I see don't talk much about
> handling legacy services, just describing what they are.
>
> So how do you manually stop and start a legacy service like this?

Use the legacy script.

--
Ian Collins

for...@gmail.com

unread,
Apr 26, 2011, 6:15:06 PM4/26/11
to

> Did you know Solaris 10 ships with Apache2?  Last time I looked, the
> CSWapache2 package had some notes on how to use it with SMF.

The installation now does the SMF automatically. I didn't see
anything else in the package.

>
> > After a while, it occurred to me the method I expected to stop
> > and start these services manually doesn't work:
>
> > # svcadm disable  lrc:/etc/rc3_d/S50httpd
> > svcadm: Operation not supported for legacy service 'lrc:/etc/rc3_d/
> > S50httpd'
>
> > The script is in /lib/svc/method/http-apache2.
>
> This is the stock Solaris 10 Apache2 script.

Ah, okay - for some reason I thought CSW was doing this. Never the
less, I modified it to suit our setup for /opt/csw and it "sorta"
works.


>
> > So how do you manually stop and start a legacy service like this?
>
> Use the legacy script.

The legacy script just calls apachectl. When you do this, the httpd
process is just respawned. It will not stop. That's the problem.

Thanks.


hume.sp...@bofh.ca

unread,
Apr 27, 2011, 9:23:23 AM4/27/11
to
for...@gmail.com <for...@gmail.com> wrote:
> The legacy script just calls apachectl. When you do this, the httpd
> process is just respawned. It will not stop. That's the problem.

SMF should not be restarting legacy items. What's the parent PID of httpd?
Is it owned by SMF?

If you dig out the contract id using "ps -o ctid -p <pid>" and dig up the
contract information using "ctstat -vi <ctid>", which service is it
associated with?

--
Brandon Hume - hume -> BOFH.Ca, http://WWW.BOFH.Ca/

hume.sp...@bofh.ca

unread,
Apr 27, 2011, 9:27:51 AM4/27/11
to
hume.sp...@bofh.ca wrote:
> If you dig out the contract id using "ps -o ctid -p <pid>" and dig up the
> contract information using "ctstat -vi <ctid>", which service is it
> associated with?

Sorry, I just realized ctstat won't produce an FMRI on Solaris 10. You can
list the processes associated with a service using "svcs -p", though.

I would list all of them. I think you might find that the httpd you're
seeing isn't coming from the FMRI you think it is.

for...@gmail.com

unread,
Apr 27, 2011, 2:16:20 PM4/27/11
to
Interesting, I have this:

online 18:33:20 svc:/network/cswapache2:default
18:33:20 9863 httpd.prefork
3:10:01 11568 httpd.prefork
3:10:01 11569 httpd.prefork
3:10:01 11570 httpd.prefork
3:10:01 11571 httpd.prefork
3:10:01 11572 httpd.prefork
3:15:08 11592 httpd.prefork

and this

legacy_run Apr_26 lrc:/etc/rc2_d/S50httpd

which is a symlink to:

lrwxrwxrwx 1 root root 17 Dec 10 2008 /etc/rc2.d/
S50httpd -> /etc/init.d/httpd

which points to /opt/csw/apache2

The cswapache2 points to the same location.

I think the /etc/init.d/httpd should be a symlink to the /etc/opt/csw/
init.d/cswapache2 script -- but I don't understand the lrc: (legacy)
input - I want one of them removed, and I think that must be the
culprit that is respawning httpd even when shut down via the script.

Thanks.


for...@gmail.com

unread,
Apr 27, 2011, 2:23:33 PM4/27/11
to
Whatever is respawning the process is definitely calling the
cswapache2 script. I can't kill it off, it just keeps coming back.
Must be something in SMF that thinks it should be doing something
else?

for...@gmail.com

unread,
Apr 27, 2011, 2:43:33 PM4/27/11
to
Okay, I figured out stopping it via svcadm and that worked. I also
made the /etc/init.d/httpd script a symlink to /etc/opt/csw/init.d/
cswapache2 -- though that will probably cause issues as I think the /
etc/rcX.d scripts were originally intended for the version shipped
with Solaris.

The developers here really just prefer the simple /etc/init.d method
-- 99% of our systems are Linux-based.


hume.sp...@bofh.ca

unread,
Apr 27, 2011, 7:39:36 PM4/27/11
to
for...@gmail.com <for...@gmail.com> wrote:
> cswapache2 -- though that will probably cause issues as I think the /
> etc/rcX.d scripts were originally intended for the version shipped
> with Solaris.

The contents of /etc/rc?.d are symlinks to the scripts in /etc/init.d.
So /etc/rc3.d/S50apache will now be a symlink to a symlink to a script.
It won't matter much, although personally I would have removed the
/etc/rc3.d symlink, backed up /etc/init.d/httpd to
/etc/init.d/httpd_unused, and put a script in /etc/init.d/httpd that
simply called svcadm as needed.

> The developers here really just prefer the simple /etc/init.d method
> -- 99% of our systems are Linux-based.

Why not just replace the Solaris box with Linux, then? That'll keep them
happy... at least, until Upstart and its equivalents catch on.

I've seen multiple Solaris machines turned into unstable wrecks when the
admins and users tried to turn them into Linux one piece at a time. Then
they inevitably blame Solaris for being such a shoddy Linux.

Ian Collins

unread,
Apr 27, 2011, 7:46:50 PM4/27/11
to
On 04/27/11 10:15 AM, for...@gmail.com wrote:
>
>> Did you know Solaris 10 ships with Apache2? Last time I looked, the
>> CSWapache2 package had some notes on how to use it with SMF.
>
> The installation now does the SMF automatically. I didn't see
> anything else in the package.

What was wrong with the pre-installed Solaris Apache2?

--
Ian Collins

bits45

unread,
Apr 27, 2011, 11:11:04 PM4/27/11
to

Maybe he can't run pre-installed Solaris Apache2 due to some security
requirements from "above" him. I get that A LOT where I work. These
so-called security wanna-bes see an IAVM (IAVA) come out and it says
some software version 1.2.3.4 is "bad" and that we MUST upgrade NOW,
or get "turned-off". Drives me insane. So, we have little choice in
the matter. Either we must learn the complexities of compiling many
different packages that must play nice together or rely on 3rd party
distributors (which we HOPE we can trust, of whom seem to do a good
job keeping ahead of the upgrade madness). It's a bad situation we're
put in all the time.

Maybe Oracle will maintain Open Source Repositories better than Sun
did. It can be argued with several view points, many of which are
valid. I know many of us are not looking at Oracle with high-hopes,
but only time will tell. I hear Wal-Mark is hiring.

{:-\

0 new messages