![]() |
![]() |
| ||||||||||||||||||||||||||||||||||||||||||||||||||
Using a Run Control Script to Stop or Start ServicesNote - The way system services are started and stopped in Solaris environment might change in some future release. One advantage of having individual scripts for each run level is that you can run scripts in the /etc/init.d directory individually to stop system services without changing a system's run level.
|
# /etc/init.d/filename stop |
Restart the system service.
# /etc/init.d/filename start |
Verify that the service has been stopped or started.
# pgrep -f service |
For example, you can stop the NFS server daemons by typing the following:
# /etc/init.d/nfs.server stop # pgrep -f nfs # |
Then, you can restart the NFS server daemons by typing the following:
# /etc/init.d/nfs.server start
# pgrep -f nfs
341
343
347
345
# pgrep -f nfs -d, | xargs ps -fp
UID PID PPID C STIME TTY TIME CMD
daemon 341 1 0 Aug 21 ? 0:00 /usr/lib/nfs/statd
root 343 1 0 Aug 21 ? 0:00 /usr/lib/nfs/lockd
root 347 1 0 Aug 21 ? 0:41 /usr/lib/nfs/nfsd
root 345 1 0 Aug 21 ? 0:02 /usr/lib/nfs/mountd
|
Note - The way system services are started and stopped in the Solaris environment might change in some future release.
If you want to add a run control script to start and stop a service, copy the script into the /etc/init.d directory. Then, create links in the rcn.d directory where you want the service to start and stop.
See the README file in each /etc/rcn.d directory for more information on naming run control scripts. The following procedure describes how to add a run control script.
How to Add a Run Control ScriptBecome superuser.
Add the script to the /etc/init.d directory.
# cp filename /etc/init.d # chmod 0744 /etc/init.d/filename # chown root:sys /etc/init.d/filename |
Create links to the appropriate rcn.d directory.
# cd /etc/init.d # ln filename /etc/rc2.d/Snnfilename # ln filename /etc/rcn.d/Knnfilename |
Verify that the script has links in the specified directories.
# ls /etc/init.d/ /etc/rc2.d/ /etc/rcn.d/ |
The following example shows how to add a run control script for the xyz service.
# cp xyz /etc/init.d # chmod 0744 /etc/init.d/xyz # chown root:sys /etc/init.d/xyz # cd /etc/init.d # ln xyz /etc/rc2.d/S100xyz # ln xyz /etc/rc0.d/K100xyz # ls /etc/init.d /etc/rc2.d /etc/rc0.d |
You can disable a run control script by renaming it with an underscore (_) at the beginning of the file name. Files that begin with an underscore or dot are not executed. If you copy a file by adding a suffix to it, both files will be run.
How to Disable a Run Control ScriptBecome superuser.
Rename the script by adding an underscore (_) to the beginning of the new file.
# cd /etc/rcn.d # mv filename _filename |
Verify that the script has been renamed.
# ls _* # _filename |
The following example shows how to rename the S100datainit script.
# cd /etc/rc2.d # mv S100datainit _S100datainit # ls _* # _S100datainit |
In addition to the run control scripts and boot files described previously, there are additional boot files that are associated with booting a Solaris x86 system.
Table 11-5 x86: Boot Files
File | Description |
|---|---|
/etc/bootrc | Contains menus and options for booting the Solaris release. |
/boot | Contains files and directories needed to boot the system. |
/boot/mdboot | DOS executable that loads the first-level bootstrap program (strap.com) into memory from disk. |
/boot/mdbootbp | DOS executable that loads the first-level bootstrap program (strap.com) into memory from diskette. |
/boot/rc.d | Directory that contains install scripts. Do not modify the contents of this directory. |
/boot/solaris | Directory that contains items for the boot subsystem. |
/boot/solaris/boot.bin | Loads the Solaris kernel or standalone kadb. In addition, this executable provides some boot firmware services. |
/boot/solaris/boot.rc | Prints the Solaris x86 Platform Edition and runs the Device Configuration Assistant in DOS-emulation mode. |
/boot/solaris/bootconf.exe | DOS executable for the Device Configuration Assistant. |
/boot/solaris/bootconf.txt | Text file that contains internationalized messages for Device Configuration Assistant (bootconf.exe). |
/boot/solaris/bootenv.rc | Stores eeprom variables that are used to set up the boot environment. |
/boot/solaris/devicedb | Directory that contains the master file, a database of all possible devices supported with realmode drivers. |
/boot/solaris/drivers | Directory that contains realmode drivers. |
/boot/solaris/itup2.exe | DOS executable run during install time update (ITU) process. |
/boot/solaris/machines | Obsolete directory. |
/boot/solaris/nbp | File associated with network booting. |
/boot/solaris/strap.rc | File that contains instructions on what load module to load and where in memory it should be loaded. |
/boot/strap.com | DOS executable that loads the second-level bootstrap program into memory. |
Previous Contents Index Next ![]() |