Linux command
service 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
service --status-all
Start/Stop/Restart/Reload
service [service_name] [start|stop|restart|reload]
Example
service [service_name] --full-restart
Example
service [service_name] status
说明
service is a wrapper for init scripts in /etc/init.d/, providing a consistent interface to manage SysV init services. It automatically handles environment sanitization and path normalization for init script execution. On systemd systems, service typically redirects commands to systemctl for backward compatibility. It remains useful for managing traditional init scripts and provides a familiar interface for administrators.
参数
- --status-all
- List status of all services
- start
- Start the service
- stop
- Stop the service
- restart
- Stop and start the service
- reload
- Reload service configuration
- status
- Show service status
- --full-restart
- Perform full stop then start sequence
FAQ
What is the service command used for?
service is a wrapper for init scripts in /etc/init.d/, providing a consistent interface to manage SysV init services. It automatically handles environment sanitization and path normalization for init script execution. On systemd systems, service typically redirects commands to systemctl for backward compatibility. It remains useful for managing traditional init scripts and provides a familiar interface for administrators.
How do I run a basic service example?
Run `service --status-all` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --status-all do in service?
List status of all services