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

How to use the service command in Linux Foundation

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is mainly for everyone to analyze the Linux foundation of the service command how to use the relevant knowledge points, detailed and easy to understand, reasonable operation details, with a certain reference value. If you are interested, you may wish to follow Xiao Bian to have a look. Let's follow Xiao Bian to learn more about how to use the service command in Linux foundation.

service*

service can control system services (on, off, heavy *)

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 Display all service status-full-restart Restart the service, run twice, stop first and then start [service_name cmd] control service. 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-allabrt-ccpp hook is installedabrtd (pid 2031) 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 `stopped

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 Display all service status-full-restart Restart the service, run twice, stop first and then start [service_name cmd] control service. 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-allabrt-ccpp hook is installedabrtd (pid 2031) 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 `stopped

(c). 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.

Linux is a free-to-use and freely distributed UNIX-like operating system, is a POSIX-based multi-user, multitasking, multi-threaded and multi-CPU operating system, using Linux to run major Unix tools, applications and network protocols.

About "how to use the service command in Linux foundation" on this introduction, more related content can be searched for previous articles, hope to help you answer questions, please support the website more!

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

Development

Wechat

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

12
Report