How to check services are running or not in Solaris

1

Particularly, I want to check Samba services and see if it is running or not in Solaris machine.

For Linux, we can check with below command.

service smb status
smbd (pid  8058) is running...

Gyana Ranjan

Posted 2015-08-20T03:20:10.843

Reputation: 11

Answers

1

Unlike on Linux, there's a unified service system on Solaris. It is called SMF. To check if a service is running use the svcs command. svcs -a will give you status of all services configured on the system, including disabled services.

Here's an example where I already know the service name, in this case /network/http:apache22, which is my Apache Web server. Using the -l and -p switches I can get a lot of information about the service, including what dependencies it has (pre-conditions) and what processes IDs it is currently executing under.

$ svcs -lp /network/http:apache22
fmri         svc:/network/http:apache22
name         Apache 2.2 HTTP server
enabled      true
state        online
next_state   none
state_time   Tue Dec 27 09:53:38 2016
logfile      /var/svc/log/network-http:apache22.log
restarter    svc:/system/svc/restarter:default
contract_id  76060
manifest     /lib/svc/manifest/network/http-apache22.xml
manifest     /lib/svc/manifest/network/http-squid.xml
dependency   require_all/error svc:/milestone/network:default (online)
dependency   require_all/none svc:/system/filesystem/local:default (online)
dependency   optional_all/error svc:/system/filesystem/autofs:default (online)
process      2474 /usr/apache2/2.2/bin/httpd -k start
process      13181 /usr/apache2/2.2/bin/httpd -k start
process      13183 /usr/apache2/2.2/bin/httpd -k start
process      13184 /usr/apache2/2.2/bin/httpd -k start
process      13185 /usr/apache2/2.2/bin/httpd -k start
process      13186 /usr/apache2/2.2/bin/httpd -k start
process      13187 /usr/apache2/2.2/bin/httpd -k start

Peter Hansson

Posted 2015-08-20T03:20:10.843

Reputation: 53

0

You can use ps -ef to find the services running or not on a Solaris machine:

$ps -ef |grep smbd
root  3214  3886   0 20:49:40 ?           0:03 /usr/local/samba64/sbin/smbd -D
root 15273  3886   0   Nov 07 ?           0:04 /usr/local/samba64/sbin/smbd -D
root 23061  3886   0 11:12:30 ?           0:01 /usr/local/samba64/sbin/smbd -D

Gyana Ranjan

Posted 2015-08-20T03:20:10.843

Reputation: 11