Linux - Service client

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





Discover More
Bash Liste Des Attaques Ovh
Bash - Complete (Builtin command) - Completion

The programmable completion feature in Bash permits typing a partial command, then pressing the [Tab] key to auto-complete the command sequence The process of applying these completion specifications...
Init - SysV init Script

The init script are bash script that are run by the init daemon. see See sudo Each script will be run as a command and the structure of the command will look like: Where command is the actual...
Linux - Boot (Init service system)

The Init system is the first process (as PID 1) started by a operating system at system startup that start all other service (ie services) The following are possible init system: bash...
Samba Swat Homepage
Linux - Samba - The Samba Web Administration Tool (swap)

SWAT is a web-based application that help to configure Samba. Swap is installed with the installation of samba. You can verify the installation by performing this command : swat -? swat answer...
Bash Liste Des Attaques Ovh
Linux - nohup (No Hangup)

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. nohup is most often used to run script or command...
Card Puncher Data Processing
Linux / Unix

Linux is an open source software and anyone can take it and create this own Linux (of distribution). It's why you can find a lot of distribution on the market : Red Hat Oracle Enterprise Linux (which...
Systemctl

systemctl is the manager utility of systemd. The systemctl utility support only the start, stop, and status command service see service status Tail
Bash Liste Des Attaques Ovh
What is Sudo? (Switch User and do)

sudo is an command utility that: su: switch user su and do: execute a command In other words, it executes a command as another user. (ie it's a proxy authentication utility) It determines who...
Process States
What is a Service?

A service is a process that: runs continuously in the background are started by the operating system when the system starts. It's declared and managed by the OS init system. With the init system,...



Share this page:
Follow us:
Task Runner