This post is in complement to the SMF interface post.
Here are a few examples for the svcadm command.
Restarting the system-log (syslog) service.
Assume that /etc/syslog.conf wasn't changed.
In this case there's no need to refresh before restarting.
# ll /var/adm/messages
-rw-r--r-- 1 root root 29K Jan 24 15:35 /var/adm/messages
# svcadm restart system-log
# ll /var/adm/messages
-rw-r--r-- 1 root root 29K Jan 29 10:24 /var/adm/messages
# tail /var/adm/messages
...
Jan 24 15:35:53 server-1 ... NOTICE: ...
Jan 29 10:24:31 server-1 syslogd: going down on signal 15
The refresh subcommand sometimes (or frequently?) implies a restart.
As a best practice it's a good idea to follow a refresh with a restart.
There's no clear rule about this particular behavior of refresh.
Probably it's to cope with legacies and other constraints.
Here's an example where the refresh subcommand seems enough.
# grep Banner /etc/ssh/sshd_config
# Banner to be printed before authentication starts.
Banner /etc/issue
# svcs -p ssh
STATE STIME FMRI
online 10:40:21 svc:/network/ssh:default
10:40:21 16779 sshd
# svcadm refresh ssh
# svcs -p ssh
STATE STIME FMRI
online 10:41:35 svc:/network/ssh:default
10:41:35 16797 sshd
Examples of the enable and disable subcommands.
# svcs -p apache22
STATE STIME FMRI
disabled Jan_24 svc:/network/http:apache22
# svcadm enable apache22
# svcs -p apache22
STATE STIME FMRI
online 11:05:35 svc:/network/http:apache22
11:05:35 16853 httpd
11:05:36 16854 httpd
11:05:36 16855 httpd
11:05:36 16856 httpd
11:05:36 16857 httpd
11:05:36 16858 httpd
# svcadm disable apache22
# svcs -p apache22
STATE STIME FMRI
disabled 11:08:08 svc:/network/http:apache22
# svcs -l apache22 | grep log
logfile /var/svc/log/network-http:apache22.log
# tail /var/svc/log/network-http:apache22.log
[ Dec 10 12:39:36 Disabled. ]
[ Jan 29 11:05:33 Enabled. ]
[ Jan 29 11:05:33 Executing start method
("/lib/svc/method/http-apache22 start"). ]
Apache version is 2.2
[ Jan 29 11:05:35 Method "start" exited with status 0. ]
[ Jan 29 11:08:08 Stopping because service disabled. ]
[ Jan 29 11:08:08 Executing stop method
("/lib/svc/method/http-apache22 stop"). ]
Apache version is 2.2
[ Jan 29 11:08:08 Method "stop" exited with status 0. ]
A mis-configured DHCP service will go into the maintenance state.
After troubleshooting, recover the service with the clear subcommand.
# svcs dhcp/server
STATE STIME FMRI
disabled Jan_24 svc:/network/dhcp/server:ipv4
disabled Jan_24 svc:/network/dhcp/server:ipv6
# svcadm enable dhcp/server:ipv4
# svcs dhcp/server:ipv4
STATE STIME FMRI
maintenance 11:31:15 svc:/network/dhcp/server:ipv4
# vi /etc/inet/dhcpd4.conf
# svcadm clear dhcp/server:ipv4
# svcs dhcp/server:ipv4
STATE STIME FMRI
online 11:43:32 svc:/network/dhcp/server:ipv4
Here are a few examples for the svcadm command.
Restarting the system-log (syslog) service.
Assume that /etc/syslog.conf wasn't changed.
In this case there's no need to refresh before restarting.
# ll /var/adm/messages
-rw-r--r-- 1 root root 29K Jan 24 15:35 /var/adm/messages
# svcadm restart system-log
# ll /var/adm/messages
-rw-r--r-- 1 root root 29K Jan 29 10:24 /var/adm/messages
# tail /var/adm/messages
...
Jan 24 15:35:53 server-1 ... NOTICE: ...
Jan 29 10:24:31 server-1 syslogd: going down on signal 15
The refresh subcommand sometimes (or frequently?) implies a restart.
As a best practice it's a good idea to follow a refresh with a restart.
There's no clear rule about this particular behavior of refresh.
Probably it's to cope with legacies and other constraints.
Here's an example where the refresh subcommand seems enough.
# grep Banner /etc/ssh/sshd_config
# Banner to be printed before authentication starts.
Banner /etc/issue
# svcs -p ssh
STATE STIME FMRI
online 10:40:21 svc:/network/ssh:default
10:40:21 16779 sshd
# svcadm refresh ssh
# svcs -p ssh
STATE STIME FMRI
online 10:41:35 svc:/network/ssh:default
10:41:35 16797 sshd
Examples of the enable and disable subcommands.
# svcs -p apache22
STATE STIME FMRI
disabled Jan_24 svc:/network/http:apache22
# svcadm enable apache22
# svcs -p apache22
STATE STIME FMRI
online 11:05:35 svc:/network/http:apache22
11:05:35 16853 httpd
11:05:36 16854 httpd
11:05:36 16855 httpd
11:05:36 16856 httpd
11:05:36 16857 httpd
11:05:36 16858 httpd
# svcadm disable apache22
# svcs -p apache22
STATE STIME FMRI
disabled 11:08:08 svc:/network/http:apache22
# svcs -l apache22 | grep log
logfile /var/svc/log/network-http:apache22.log
# tail /var/svc/log/network-http:apache22.log
[ Dec 10 12:39:36 Disabled. ]
[ Jan 29 11:05:33 Enabled. ]
[ Jan 29 11:05:33 Executing start method
("/lib/svc/method/http-apache22 start"). ]
Apache version is 2.2
[ Jan 29 11:05:35 Method "start" exited with status 0. ]
[ Jan 29 11:08:08 Stopping because service disabled. ]
[ Jan 29 11:08:08 Executing stop method
("/lib/svc/method/http-apache22 stop"). ]
Apache version is 2.2
[ Jan 29 11:08:08 Method "stop" exited with status 0. ]
A mis-configured DHCP service will go into the maintenance state.
After troubleshooting, recover the service with the clear subcommand.
# svcs dhcp/server
STATE STIME FMRI
disabled Jan_24 svc:/network/dhcp/server:ipv4
disabled Jan_24 svc:/network/dhcp/server:ipv6
# svcadm enable dhcp/server:ipv4
# svcs dhcp/server:ipv4
STATE STIME FMRI
maintenance 11:31:15 svc:/network/dhcp/server:ipv4
# vi /etc/inet/dhcpd4.conf
# svcadm clear dhcp/server:ipv4
# svcs dhcp/server:ipv4
STATE STIME FMRI
online 11:43:32 svc:/network/dhcp/server:ipv4