|
|||
1. Solaris Management Tools (Road Map) 2. Working With the Solaris Management Console (Tasks) 3. Working With the Sun Java Web Console (Tasks) 4. Managing User Accounts and Groups (Overview) 5. Managing User Accounts and Groups (Tasks) 6. Managing Client-Server Support (Overview) 7. Managing Diskless Clients (Tasks) 8. Introduction to Shutting Down and Booting a System 9. Shutting Down and Booting a System (Overview) 10. Shutting Down a System (Tasks) 11. Modifying Solaris Boot Behavior (Tasks) 12. Booting a Solaris System (Tasks) 13. Troubleshooting Booting a Solaris System (Tasks) 14. Managing the Solaris Boot Archives (Tasks) 15. x86: GRUB Based Booting (Reference) 16. Managing Services (Overview) Managing SMF Services (Task Map) Using Run Control Scripts (Task Map) Troubleshooting the Service Management Facility 18. Managing Software (Overview) 19. Managing Software With Solaris System Administration Tools (Tasks) 20. Managing Software by Using Package Commands (Tasks) 21. Managing Solaris Patches by Using the patchadd Command (Tasks) |
Using Run Control ScriptsHow to Use a Run Control Script to Stop or Start a Legacy ServiceOne 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.
Example 17-15 Using a Run Control Script to Stop or Start a ServiceFor 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 101773 101750 102053 101748 101793 102114 # pgrep -f nfs -d, | xargs ps -fp UID PID PPID C STIME TTY TIME CMD daemon 101748 1 0 Sep 01 ? 0:06 /usr/lib/nfs/nfsmapid daemon 101750 1 0 Sep 01 ? 26:27 /usr/lib/nfs/lockd daemon 101773 1 0 Sep 01 ? 5:27 /usr/lib/nfs/statd root 101793 1 0 Sep 01 ? 19:42 /usr/lib/nfs/mountd daemon 102053 1 0 Sep 01 ? 2270:37 /usr/lib/nfs/nfsd daemon 102114 1 0 Sep 01 ? 0:35 /usr/lib/nfs/nfs4cbd How to Add a Run Control ScriptIf 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.
Example 17-16 Adding a Run Control ScriptThe 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/S99xyz # ln xyz /etc/rc0.d/K99xyz # ls /etc/init.d/*xyz /etc/rc2.d/*xyz /etc/rc0.d/*xyz How to Disable a Run Control ScriptYou 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.
Example 17-17 Disabling a Run Control ScriptThe following example shows how to rename the S99datainit script. # cd /etc/rc2.d # mv S99datainit _S99datainit # ls _* _S99datainit |
||
|