Table of Contents

About

service is the client tool of the sysvinit system.

For the systemd init service, see the systemctl client

Syntax

service

service SCRIPT COMMAND [OPTIONS]

where:

Most environment variables are removed

Management

Start / Stop / Restart / Status

service serviceName start
service serviceName stop
service serviceName restart
service serviceName status
service xinetd start
service xinetd stop
service xinetd restart
service xinetd status

From the GUI: System / Administration / Server Settings / Services

When using the init system, it will running the service init scripts located in the /etc/init.d/.

List all running service

The service –status-all runs all init scripts, in alphabetical order, with the status command.

service --status-all | grep running
acpid (pid 2185) is running...
atd (pid  2459) is running...
auditd (pid  2032) is running...
automount (pid 2279) is running...
Avahi daemon is running
Avahi DNS daemon is not running
capi not installed - No such file or directory (2)
crond (pid  2413) is running...
gpm (pid  2394) is running...
hald (pid 2199) is running...
hidd (pid 2256) is running...
httpd (pid  2404) is running...
irqbalance (pid 2070) is running...
dbus-daemon (pid 4741 4532 2134) is running...

Give permissions to a user to start and stop

In the /etc/sudoers file, add the following:

userName  ALL=(ALL) NOPASSWD: /sbin/service serviceName start
userName  ALL=(ALL) NOPASSWD: /sbin/service serviceName stop

then the user can start and stop the service with the following statement

sudo service serviceName start
sudo service serviceName stop