1

I need to execute a command after a network interface came up. On Debian I would use the post-up option in /etc/network/interfaces. But I can not find anything similar for Solaris 10. Is it possible to execute a command after network initialization?

2 Answers 2

3

Solaris uses SMF to control the system and init(1m) just starts /lib/svc/bin/svc.startd that is controlled by xml files.

To learn how the system works, I recommend to read the man pages for smf (the overview), svcs (the service status reporter - run this first to understand more) and svcadm (the program to manage the system).

If you like to add a service that is run after the network is up, you should write a service description (xml) file that says "I depend on svc:/milestone/network:default" and install that service.

In order to be able to do more, you definitely would need to read the documentation.

0

Solaris takes its queue from I think unix 7, the rc scripts ie run command scripts, as does *BSD oses.

Have a look at the docs.

So under /etc/rc*.d are the scripts that executed during different run levels. rc2.d is the run level where networking is brought as shown by /etc/rc2 script on Solaris 11, as I don't have Solaris 10 laying around

5
  • The file /etc/rc2.d/README states that the rc scripts are legacy initialization scripts. Instead I should prefer smf.
    – ceving
    Commented Sep 2, 2015 at 8:20
  • Your link describes Solaris 9.
    – ceving
    Commented Sep 2, 2015 at 8:24
  • I no little of solaris, I understand rc and how to use it as I use bsd, smf is a world away for me. Regardless if the docs are for solaris 9, the run levels will never change...any time soon
    – gwillie
    Commented Sep 2, 2015 at 8:28
  • 1
    Correct, rc scripts still work but do not permit to let things depend on another action. This is why SMF has been introduced in August 2004.
    – schily
    Commented Sep 2, 2015 at 9:33
  • Adding your script to /etc/rc3.d/S99<file> and hard linking it to /etc/init.d/<file> is the easiest. If you want it to run right after the network is up and usable, use SMF as schily notes. Commented Jun 8, 2017 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .