Service Management: Difference between revisions

From Leo's Notes
This page was last edited on 15 April 2013, at 05:23.
Created page with "== Linux == Use <strong>any one</strong> of: /etc/init.d/<service> restart /etc/init.d/<service> stop && /etc/init.d/<service> start service <service> res..."
 
No edit summary
Line 2: Line 2:
Use <strong>any one</strong> of:
Use <strong>any one</strong> of:
  /etc/init.d/&lt;service&gt; restart
  /etc/init.d/&lt;service&gt; restart
  /etc/init.d/&lt;service&gt; stop && /etc/init.d/<service> start
  /etc/init.d/&lt;service&gt; stop && /etc/init.d/<service> start
  service &lt;service&gt; restart
  service &lt;service&gt; restart


Line 34: Line 36:
Example: To restart ssh, do <strong>any one</strong> of:
Example: To restart ssh, do <strong>any one</strong> of:
  svcadm restart ssh
  svcadm restart ssh
  svcadm restart svc:/network/ssh
  svcadm restart svc:/network/ssh
  /lib/svc/method/sshd restart
  /lib/svc/method/sshd restart
[[Category:Linux]]
[[Category:FreeBSD]]
[[Category:Solaris]]

Revision as of 05:23, 15 April 2013

Linux

Use any one of:

/etc/init.d/<service> restart
/etc/init.d/<service> stop && /etc/init.d/<service> start
service <service> restart

Since the location of startup scripts varies from distro to distro, using the service command is recommended.

FreeBSD

Similar to linux, you can either start services using their startup scripts or using the service command.

Usually, the startup scripts are located in /etc/rc.d

/etc/rc.d/<service> restart

However, if it is 3rd party software, they are located in /usr/local/etc/rc.d

/usr/local/etc/rc.d/<service> restart

Or to not worry about any of the above, use service

service nfs stop
service sickbeard start
service httpd status


Note: You can send the HUP signal to restart a service. For instance, to restart NFS, you can do any one of:

kill -HUP `cat /var/run/mountd.pid`
/etc/rc.d/nsfd restart
service nfs restart

Solaris / SunOS

The startup scripts are located in /lib/svc/method/<service>

/lib/svc/method/<service> restart
svcadm restart <service>

Example: To restart ssh, do any one of:

svcadm restart ssh
svcadm restart svc:/network/ssh
/lib/svc/method/sshd restart