Managing Services in Solaris

Points to remember about run levels / milestones : Runlevels are used in Solaris 9 to describe the set of services. "who -r" tells you which level you're in. Starting from Solaris version 10, runlevels are replaced by milestones. Run Levels in Solaris 8/9 : S : Single user state (useful for recovery) 0 : Access Sun Firmware ( ok> prompt) 1 : System administrator mode 2 : Multi-user w/o NFS 3 : Multi-user with NFS 4 : Unused 5 : Completely shutdown the host (like performing a power-off @ OBP) [ thanks to Marco 6 : Reboot but depend upon initdefault entry in /etc/inittab Different milestones in Solaris 10 : single-user : Single User Mode multi-user : Multi-User with/o NFS multi-user-server : Multi-User with NFS all : Starts all the services none : Doe not start any services. Normally used for troubleshooting purposes. Different states of services in SMF: online : Service instance enabled and running. offline : Service instance enabled, but not running due to some fault. disabled : Service instace is disabled and not running. maintenance : Service instance encountered an error, troubleshooting is required. legacy_run : Legacy service (controlled by /etc/rcx.net scripts). SMF can only monitor this service, but can't control it. degraded : Service instance enabled but running at limited capacity. uninitialized : This is the initial stat for all services before their configuration has been read. Commands : 1. To list all the services and their status : # svcs -a 2. To stop SSH service : # svcadm disable -t network/ssh:default <--- Solaris 10 # /etc/init.d/sshd stop <--- Solaris 9 3. To start SSH service : # svcadm enable -t network/ssh:default # /etc/init.d/sshd start 4. To refresh SSH service :

<--- Solaris 10

<--- Solaris 9

# svcadm refresh -t network/ssh:default # ps -ef | grep ssh # kill -HUP pid 5. To restart SSH service : # svcadm restart -t network/ssh:default # /etc/init.d/sshd stop # /etc/init.d/sshd start

<--- Solaris 10

<--- Solaris 9

<--- Solaris 10

<--- Solaris 9

6. To find out what went wrong or the reason behind a service shutdown : # svcs -x 7. To find out the dependents of a failed service : # svcs -x -v 8. To find out the status and PID of a service : # svcs -p network/smtp:sendmail 9. To find out the dependent services : # svcs -d milestone/multi-user:default 10. To show on what service, the current service depends on : # svcs -D network/smtp:sendmail 11. To view the detailed status of a service : # svcs -v network/smtp:sendmail 12. To view the details of a service : # svcs -l network/smtp:sendmail 13. To list all the internet services : # inetadm Note: /etc/inet/inetd.conf is not used in Solaris 10. 14. To enable a internet service : # inetadm -e network/telnet 15. To disable a internet service : # inetadm -d network/telnet 16. To show the details of telnet service : # inetadm -l network/telnet 17. To modify a property of ftp service : # inetadm -m network/ftp exec="/usr/sbin/in.ftpd -l"

18. To change the default milestone (run level) : # svcadm milestone -d milestone/single-user:default In solaris 9, you have to change it in /etc/inittab. 19. To go to a milestone (run level) : # svcadm milestone milestone/single-user:default In solaris 9, # init 1 20. To boot a machine in single user mode from OK prompt : ok> boot -m milestone=single-user 21. To boot a machine in multi user mode from OK prompt : ok> boot -m milestone=multi-user 22. To restore SMF repository : # /lib/svc/bin/restore_repository 23. Daemon that controls SMF : While booting the system, svc.startd gets started via /etc/inittab and it starts the services based on the milestone selected.

Sign up to vote on this title
UsefulNot useful