Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The usage of the Linux basic command service

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the usage of Linux basic command service", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "the usage of Linux basic command service"!

service

Service can control system services (on, off, restart). service Runs the SystemV init script in as predictable an environment as possible, removing most environment variables and setting the current working directory to the root directory. System V init script with script parameters in "/etc/init.d/script". Supported command values depend on the script invoked, and the service passes commands and options to the init script.

All scripts should support at least the start command and the stop command. As an exception, if the command is "--full-restart," the script runs twice, first with the stop command and then with the start command. "service --status-all" runs all the init scripts alphabetically, executing the status command. Users can find script files for the service in the/etc/init.d/directory.

Only the environment variables LANG and TERM are passed to the init script file.

This command applies to Red Hat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

service SCRIPT COMMAND [OPTIONS]

service --status-all

service --help | -h | --version

2. Option list

option

description

-h | --help

help information

-V | --version

Display command version information

--status-all

Show all service status

--full-restart

Restart the service, run twice, stop first and then start

[service_name cmd]

Control services. For example, service vsftpd start. cmd can be start, stop, restart

3. Examples

1) View the current operating status of all services

[root@localhost ~]# service --status-all

abrt-ccpp hook is installed

abrtd (pid 2031) is running...

abrt-dump-oops stopped

acpid (pid 1507) is running..

2) View the running status of the specified service (vsftpd)

[root@localhost ~]# service vsftpd status

vsftpd (pid 30818) is running...

3) Stop specified services (vsftpd)

[root@localhost ~]# service vsftpd stop

Close vsftpd: [OK]

[root@localhost ~]# service vsftpd status

vsftpd has stopped.

At this point, I believe that everyone has a deeper understanding of the "Linux basic command service usage", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report