- 9. 7. 1. Kích hoạt cài đặt tự động cập nhật
- 9. 7. 2. Thiết lập thông báo email tùy chọn
- 9. 7. 3. Kích hoạt hoặc vô hiệu hóa các kho lưu trữ cụ thể
- 9. 7. 4. Kiểm tra cài đặt Yum-cron
- 9. 7. 5. Vô hiệu hóa tin nhắn Yum-cron
- 9. 7. 6. Tự động làm sạch các gói
- 10. Quản lý dịch vụ với systemd Mở rộng phần "10. Quản lý dịch vụ với systemd" Thu gọn phần "10. Quản lý dịch vụ với systemd"
- 10. 1. Giới thiệu về systemd Mở rộng phần "10. 1. Giới thiệu về systemd" Thu gọn phần "10. 1. Giới thiệu về systemd"
- 10. 1. 1. Những đặc điểm chính
- 10. 1. 2. Thay đổi tương thích
- 10. 2. Quản lý dịch vụ hệ thống Mở rộng phần "10. 2. Quản lý dịch vụ hệ thống" Thu gọn phần "10. 2. Quản lý dịch vụ hệ thống"
- 10. 2. 1. Listing Services
- 10. 2. 2. Displaying Service Status
- 10. 2. 3. Starting a Service
- 10. 2. 4. Stopping a Service
- 10. 2. 5. Restarting a Service
- 10. 2. 6. Enabling a Service
- 10. 2. 7. Disabling a Service
- 10. 2. 8. Starting a Conflicting Service
- 10. 3. Working with systemd Targets Expand section "10. 3. Working with systemd Targets" Collapse section "10. 3. Working with systemd Targets"
- 10. 3. 1. Viewing the Default Target
- 10. 3. 2. Viewing the Current Target
- 10. 3. 3. Changing the Default Target
- 10. 3. 4. Changing the Current Target
- 10. 3. 5. Changing to Rescue Mode
- 10. 3. 6. Thay đổi sang Chế độ Khẩn cấp
- 10. 4. Shutting Down, Suspending, and Hibernating the System Expand section "10. 4. Shutting Down, Suspending, and Hibernating the System" Collapse section "10. 4. Shutting Down, Suspending, and Hibernating the System"
- 10. 4. 1. Shutting Down the System
- 10. 4. 2. Restarting the System
- 10. 4. 3. Suspending the System
- 10. 4. 4. Hibernating the System
- 10. 5. Controlling systemd on a Remote Machine
- 10. 6. Creating and Modifying systemd Unit Files Expand section "10. 6. Creating and Modifying systemd Unit Files" Collapse section "10. 6. Creating and Modifying systemd Unit Files"
- 10. 6. 1. Understanding the Unit File Structure
- 10. 6. 2. Creating Custom Unit Files
- 10. 6. 3. Converting SysV Init Scripts to Unit Files
- 10. 6. 4. Modifying Existing Unit Files
- 10. 6. 5. Working with Instantiated Units
- 10. 7. Additional Considerations While Managing Services
- 10. 8. Additional Resources
- 10. 1. Giới thiệu về systemd Mở rộng phần "10. 1. Giới thiệu về systemd" Thu gọn phần "10. 1. Giới thiệu về systemd"
- 11. Configuring a System for Accessibility Expand section "11. Configuring a System for Accessibility" Collapse section "11. Configuring a System for Accessibility"
- 11. 1. Configuring the brltty Service
- 11. 2. Switch On Always Show Universal Access Menu
- 11. 3. Enabling the Festival Speech Synthesis System
- 12. OpenSSH Expand section "12. OpenSSH" Thu gọn phần "12. OpenSSH"
- 12. 1. Giao thức SSH Mở rộng phần "12. 1. Giao thức SSH" Thu gọn phần "12. 1. Giao thức SSH"
- 12. 1. 1. Tại sao nên sử dụng SSH?
- 12. 1. 2. Những đặc điểm chính
- 12. 1. 3. Phiên bản giao thức
- 12. 1. 4. Chuỗi sự kiện của kết nối SSH Mở rộng phần "12. 1. 4. Chuỗi sự kiện của kết nối SSH" Thu gọn phần "12. 1. 4. Chuỗi sự kiện của kết nối SSH"
- 12. 1. 4. 1. Lớp vận chuyển
- 12. 1. 4. 2. xác thực
- 12. 1. 4. 3. Channels
- 12. 2. Configuring OpenSSH Expand section "12. 2. Configuring OpenSSH" Collapse section "12. 2. Định cấu hình OpenSSH"
- 12. 2. 1. Configuration Files
- 12. 2. 2. Bắt đầu một máy chủ OpenSSH
- 12. 2. 3. Requiring SSH for Remote Connections
- 12. 2. 4. Using Key-based Authentication Expand section "12. 2. 4. Using Key-based Authentication" Collapse section "12. 2. 4. Using Key-based Authentication"
- 12. 2. 4. 1. Generating Key Pairs
- 12. 2. 4. 2. Configuring ssh-agent
- 12. 3. OpenSSH Clients Expand section "12. 3. OpenSSH Clients" Collapse section "12. 3. OpenSSH Clients"
- 12. 3. 1. Using the ssh Utility
- 12. 3. 2. Using the scp Utility
- 12. 3. 3. Using the sftp Utility
- 12. 4. More Than a Secure Shell Expand section "12. 4. More Than a Secure Shell" Collapse section "12. 4. More Than a Secure Shell"
- 12. 4. 1. X11 Forwarding
- 12. 4. 2. Port Forwarding
- 12. 5. Additional Resources
- 12. 1. Giao thức SSH Mở rộng phần "12. 1. Giao thức SSH" Thu gọn phần "12. 1. Giao thức SSH"
- 13. TigerVNC Expand section "13. TigerVNC" Collapse section "13. TigerVNC"
- 13. 1. VNC Server Expand section "13. 1. VNC Server" Collapse section "13. 1. VNC Server"
- 13. 1. 1. Cài đặt máy chủ VNC
- 13. 1. 2. Configuring VNC Server Expand section "13. 1. 2. Configuring VNC Server" Collapse section "13. 1. 2. Configuring VNC Server"
- 13. 1. 2. 1. Configuring VNC Server for Two Users
- 13. 1. 3. Starting VNC Server Expand section "13. 1. 3. Starting VNC Server" Collapse section "13. 1. 3. Starting VNC Server"
- 13. 1. 3. 1. Configuring VNC Server for Two Users and Two Different Displays
- 13. 1. 4. VNC setup based on xinetd with XDMCP for GDM
- 13. 1. 5. Terminating a VNC Session
- 13. 2. Sharing an Existing Desktop
- 13. 3. VNC Viewer Expand section "13. 3. VNC Viewer" Collapse section "13. 3. VNC Viewer"
- 13. 3. 1. Installing VNC Viewer
- 13. 3. 2. Connecting to VNC Server Expand section "13. 3. 2. Connecting to VNC Server" Collapse section "13. 3. 2. Connecting to VNC Server"
- 13. 3. 2. 1. Configuring the Firewall for VNC
- 13. 3. 3. Connecting to VNC Server Using SSH
- 13. 4. Additional Resources
- 13. 1. VNC Server Expand section "13. 1. VNC Server" Collapse section "13. 1. VNC Server"
- 14. Web Servers Expand section "14. Web Servers" Collapse section "14. Web Servers"
- 14. 1. The Apache HTTP Server Expand section "14. 1. The Apache HTTP Server" Collapse section "14. 1. The Apache HTTP Server"
- 14. 1. 1. Notable Changes
- 14. 1. 2. Updating the Configuration
- 14. 1. 3. Running the httpd Service Expand section "14. 1. 3. Running the httpd Service" Collapse section "14. 1. 3. Running the httpd Service"
- 14. 1. 3. 1. Starting the Service
- 14. 1. 3. 2. Stopping the Service
- 14. 1. 3. 3. Restarting the Service
- 14. 1. 3. 4. Verifying the Service Status
- 14. 1. 4. Chỉnh sửa tệp cấu hình
- 14. 1. 5. Làm việc với Mô-đun Mở rộng phần "14. 1. 5. Làm việc với các mô-đun" Thu gọn phần "14. 1. 5. Làm việc với các mô-đun"
- 14. 1. 5. 1. Đang tải một mô-đun
- 14. 1. 5. 2. Writing a Module
- 14. 1. 6. Setting Up Virtual Hosts
- 14. 1. 7. Setting Up an SSL Server Expand section "14. 1. 7. Setting Up an SSL Server" Collapse section "14. 1. 7. Setting Up an SSL Server"
- 14. 1. 7. 1. An Overview of Certificates and Security
- 14. 1. 8. Enabling the mod_ssl Module Expand section "14. 1. 8. Enabling the mod_ssl Module" Collapse section "14. 1. 8. Enabling the mod_ssl Module"
- 14. 1. 8. 1. Enabling and Disabling SSL and TLS in mod_ssl
- 14. 1. 9. Enabling the mod_nss Module Expand section "14. 1. 9. Enabling the mod_nss Module" Collapse section "14. 1. 9. Enabling the mod_nss Module"
- 14. 1. 9. 1. Enabling and Disabling SSL and TLS in mod_nss
- 14. 1. 10. Using an Existing Key and Certificate
- 14. 1. 11. Generating a New Key and Certificate
- 14. 1. 12. Configure the Firewall for HTTP and HTTPS Using the Command Line Expand section "14. 1. 12. Configure the Firewall for HTTP and HTTPS Using the Command Line" Collapse section "14. 1. 12. Configure the Firewall for HTTP and HTTPS Using the Command Line"
- 14. 1. 12. 1. Checking Network Access for Incoming HTTPS and HTTPS Using the Command Line
- 14. 1. 13. Additional Resources
- 14. 1. The Apache HTTP Server Expand section "14. 1. The Apache HTTP Server" Collapse section "14. 1. The Apache HTTP Server"
- 15. Mail Servers Expand section "15. Mail Servers" Collapse section "15. Mail Servers"
- 15. 1. Email Protocols Expand section "15. 1. Email Protocols" Collapse section "15. 1. Email Protocols"
- 15. 1. 1. Mail Transport Protocols Expand section "15. 1. 1. Mail Transport Protocols" Collapse section "15. 1. 1. Mail Transport Protocols"
- 15. 1. 1. 1. SMTP
- 15. 1. 2. Mail Access Protocols Expand section "15. 1. 2. Mail Access Protocols" Collapse section "15. 1. 2. Mail Access Protocols"
- 15. 1. 2. 1. NHẠC POP
- 15. 1. 2. 2. IMAP
- 15. 1. 2. 3. Dovecot
- 15. 1. 1. Mail Transport Protocols Expand section "15. 1. 1. Mail Transport Protocols" Collapse section "15. 1. 1. Mail Transport Protocols"
- 15. 2. Email Program Classifications Expand section "15. 2. Email Program Classifications" Collapse section "15. 2. Email Program Classifications"
- 15. 2. 1. Mail Transport Agent
- 15. 2. 2. Mail Delivery Agent
- 15. 2. 3. Mail User Agent
- 15. 3. Mail Transport Agents Expand section "15. 3. Mail Transport Agents" Collapse section "15. 3. Mail Transport Agents"
- 15. 3. 1. Postfix Expand section "15. 3. 1. Postfix" Collapse section "15. 3. 1. Postfix"
- 15. 3. 1. 1. The Default Postfix Installation
- 15. 3. 1. 2. Upgrading From a Previous Release
- 15. 3. 1. 3. Basic Postfix Configuration
- 15. 3. 1. 4. Using Postfix with LDAP Expand section "15. 3. 1. 4. Sử dụng Postfix với LDAP" Thu gọn phần "15. 3. 1. 4. Using Postfix with LDAP"
- 15. 3. 1. 4. 1. The /etc/aliases lookup example
- 15. 3. 2. Sendmail Expand section "15. 3. 2. Sendmail" Collapse section "15. 3. 2. Sendmail"
- 15. 3. 2. 1. Mục đích và Hạn chế
- 15. 3. 2. 2. The Default Sendmail Installation
- 15. 3. 2. 3. Common Sendmail Configuration Changes
- 15. 3. 2. 4. Masquerading
- 15. 3. 2. 5. Stopping Spam
- 15. 3. 2. 6. Using Sendmail with LDAP
- 15. 3. 3. Fetchmail Expand section "15. 3. 3. Fetchmail" Collapse section "15. 3. 3. Fetchmail"
- 15. 3. 3. 1. Fetchmail Configuration Options
- 15. 3. 3. 2. Global Options
- 15. 3. 3. 3. Server Options
- 15. 3. 3. 4. User Options
- 15. 3. 3. 5. Fetchmail Command Options
- 15. 3. 3. 6. Informational or Debugging Options
- 15. 3. 3. 7. Special Options
- 15. 3. 4. Mail Transport Agent [MTA] Configuration
- 15. 3. 1. Postfix Expand section "15. 3. 1. Postfix" Collapse section "15. 3. 1. Postfix"
- 15. 4. Mail Delivery Agents Expand section "15. 4. Mail Delivery Agents" Collapse section "15. 4. Mail Delivery Agents"
- 15. 4. 1. Procmail Configuration
- 15. 4. 2. Procmail Recipes Expand section "15. 4. 2. Procmail Recipes" Collapse section "15. 4. 2. Procmail Recipes"
- 15. 4. 2. 1. Delivering vs. Non-Delivering Recipes
- 15. 4. 2. 2. Flags
- 15. 4. 2. 3. Specifying a Local Lockfile
- 15. 4. 2. 4. Special Conditions and Actions
- 15. 4. 2. 5. Recipe Examples
- 15. 4. 2. 6. Spam Filters
- 15. 5. Mail User Agents Expand section "15. 5. Mail User Agents" Collapse section "15. 5. Mail User Agents"
- 15. 5. 1. Securing Communication Expand section "15. 5. 1. Securing Communication" Collapse section "15. 5. 1. Securing Communication"
- 15. 5. 1. 1. Secure Email Clients
- 15. 5. 1. 2. Securing Email Client Communications
- 15. 5. 1. Securing Communication Expand section "15. 5. 1. Securing Communication" Collapse section "15. 5. 1. Securing Communication"
- 15. 6. Configuring Mail Server with Antispam and Antivirus Expand section "15. 6. Configuring Mail Server with Antispam and Antivirus" Collapse section "15. 6. Configuring Mail Server with Antispam and Antivirus"
- 15. 6. 1. Configuring Spam Filtering for Mail Transport Agent or Mail Delivery Agent Expand section "15. 6. 1. Configuring Spam Filtering for Mail Transport Agent or Mail Delivery Agent" Collapse section "15. 6. 1. Configuring Spam Filtering for Mail Transport Agent or Mail Delivery Agent"
- 15. 6. 1. 1. Configuring Spam Filtering in a Mail Transport Agent
- 15. 6. 1. 2. Configuring Spam Filtering in a Mail Delivery Agent
- 15. 6. 2. Configuring Antivirus Protection
- 15. 6. 3. Using the EPEL Repository to install Antispam and Antivirus Software
- 15. 6. 1. Configuring Spam Filtering for Mail Transport Agent or Mail Delivery Agent Expand section "15. 6. 1. Configuring Spam Filtering for Mail Transport Agent or Mail Delivery Agent" Collapse section "15. 6. 1. Configuring Spam Filtering for Mail Transport Agent or Mail Delivery Agent"
- 15. 7. Additional Resources Expand section "15. 7. Additional Resources" Collapse section "15. 7. Additional Resources"
- 15. 7. 1. Installed Documentation
- 15. 7. 2. Online Documentation
- 15. 7. 3. Related Books
- 15. 1. Email Protocols Expand section "15. 1. Email Protocols" Collapse section "15. 1. Email Protocols"
- 16. File and Print Servers Expand section "16. File and Print Servers" Collapse section "16. File and Print Servers"
- 16. 1. Samba Expand section "16. 1. Samba" Collapse section "16. 1. Samba"
- 16. 1. 1. The Samba Services
- 16. 1. 2. Verifying the smb. conf File by Using the testparm Utility
- 16. 1. 3. Understanding the Samba Security Modes
- 16. 1. 4. Setting up Samba as a Standalone Server Expand section "16. 1. 4. Setting up Samba as a Standalone Server" Collapse section "16. 1. 4. Setting up Samba as a Standalone Server"
- 16. 1. 4. 1. Setting up the Server Configuration for the Standalone Server
- 16. 1. 4. 2. Creating and Enabling Local User Accounts
- 16. 1. 5. Setting up Samba as a Domain Member Expand section "16. 1. 5. Setting up Samba as a Domain Member" Collapse section "16. 1. 5. Setting up Samba as a Domain Member"
- 16. 1. 5. 1. Joining a Domain
- 16. 1. 5. 2. Verifying That Samba Was Correctly Joined As a Domain Member
- 16. 1. 5. 3. Understanding ID Mapping Expand section "16. 1. 5. 3. Understanding ID Mapping" Collapse section "16. 1. 5. 3. Understanding ID Mapping"
- 16. 1. 5. 3. 1. Planning ID Ranges
- 16. 1. 5. 3. 2. The * Default Domain
- 16. 1. 5. 4. The Different ID Mapping Back Ends Expand section "16. 1. 5. 4. The Different ID Mapping Back Ends" Collapse section "16. 1. 5. 4. The Different ID Mapping Back Ends"
- 16. 1. 5. 4. 1. Using the tdb ID Mapping Back End
- 16. 1. 5. 4. 2. Using the ad ID Mapping Back End
- 16. 1. 5. 4. 3. Using the rid ID Mapping Back End
- 16. 1. 5. 4. 4. Using the autorid ID Mapping Back End
- 16. 1. 6. Configuring File Shares on a Samba Server Expand section "16. 1. 6. Configuring File Shares on a Samba Server" Collapse section "16. 1. 6. Configuring File Shares on a Samba Server"
- 16. 1. 6. 1. Setting up a Share That Uses POSIX ACLs Expand section "16. 1. 6. 1. Setting up a Share That Uses POSIX ACLs" Collapse section "16. 1. 6. 1. Setting up a Share That Uses POSIX ACLs"
- 16. 1. 6. 1. 1. Adding a Share That Uses POSIX ACLs
- 16. 1. 6. 1. 2. Đặt ACL
- 16. 1. 6. 1. 3. Setting Permissions on a Share
- 16. 1. 6. 2. Setting up a Share That Uses Windows ACLs Expand section "16. 1. 6. 2. Setting up a Share That Uses Windows ACLs" Collapse section "16. 1. 6. 2. Setting up a Share That Uses Windows ACLs"
- 16. 1. 6. 2. 1. Granting the SeDiskOperatorPrivilege Privilege
- 16. 1. 6. 2. 2. Enabling Windows ACL Support
- 16. 1. 6. 2. 3. Adding a Share That Uses Windows ACLs
- 16. 1. 6. 2. 4. Managing Share Permissions and File System ACLs of a Share That Uses Windows ACLs
- 16. 1. 6. 3. Managing ACLs on an SMB Share Using smbcacls Expand section "16. 1. 6. 3. Managing ACLs on an SMB Share Using smbcacls" Collapse section "16. 1. 6. 3. Managing ACLs on an SMB Share Using smbcacls"
- 16. 1. 6. 3. 1. Understanding Access Control Entries
- 16. 1. 6. 3. 2. Displaying ACLs Using smbcacls
- 16. 1. 6. 3. 3. Calculating an ACE Mask
- 16. 1. 6. 3. 4. Adding, Updating, And Removing an ACL Using smbcacls
- 16. 1. 6. 4. Enabling Users to Share Directories on a Samba Server Expand section "16. 1. 6. 4. Enabling Users to Share Directories on a Samba Server" Collapse section "16. 1. 6. 4. Enabling Users to Share Directories on a Samba Server"
- 16. 1. 6. 4. 1. Enabling the User Shares Feature
- 16. 1. 6. 4. 2. Adding a User Share
- 16. 1. 6. 4. 3. Updating Settings of a User Share
- 16. 1. 6. 4. 4. Displaying Information About Existing User Shares
- 16. 1. 6. 4. 5. Listing User Shares
- 16. 1. 6. 4. 6. Deleting a User Share
- 16. 1. 6. 5. Enabling Guest Access to a Share
- 16. 1. 6. 1. Setting up a Share That Uses POSIX ACLs Expand section "16. 1. 6. 1. Setting up a Share That Uses POSIX ACLs" Collapse section "16. 1. 6. 1. Setting up a Share That Uses POSIX ACLs"
- 16. 1. 7. Setting up a Samba Print Server Expand section "16. 1. 7. Setting up a Samba Print Server" Collapse section "16. 1. 7. Setting up a Samba Print Server"
- 16. 1. 7. 1. The Samba spoolssd Service
- 16. 1. 7. 2. Enabling Print Server Support in Samba
- 16. 1. 7. 3. Manually Sharing Specific Printers
- 16. 1. 7. 4. Thiết lập tải xuống trình điều khiển máy in tự động cho ứng dụng khách Windows Mở rộng phần "16. 1. 7. 4. Thiết lập tải xuống trình điều khiển máy in tự động cho máy khách Windows" Thu gọn phần "16. 1. 7. 4. Setting up Automatic Printer Driver Downloads for Windows Clients"
- 16. 1. 7. 4. 1. Basic Information about Printer Drivers
- 16. 1. 7. 4. 2. Enabling Users to Upload and Preconfigure Drivers
- 16. 1. 7. 4. 3. Setting up the print$ Share
- 16. 1. 7. 4. 4. Creating a GPO to Enable Clients to Trust the Samba Print Server
- 16. 1. 7. 4. 5. Uploading Drivers and Preconfiguring Printers
- 16. 1. 8. Tuning the Performance of a Samba Server Expand section "16. 1. 8. Tuning the Performance of a Samba Server" Collapse section "16. 1. 8. Tuning the Performance of a Samba Server"
- 16. 1. 8. 1. Setting the SMB Protocol Version
- 16. 1. 8. 2. Tuning Shares with Directories That Contain a Large Number of Files
- 16. 1. 8. 3. Cài đặt có thể có tác động tiêu cực đến hiệu suất
- 16. 1. 9. Frequently Used Samba Command-line Utilities Expand section "16. 1. 9. Frequently Used Samba Command-line Utilities" Collapse section "16. 1. 9. Frequently Used Samba Command-line Utilities"
- 16. 1. 9. 1. Using the net Utility Expand section "16. 1. 9. 1. Using the net Utility" Collapse section "16. 1. 9. 1. Using the net Utility"
- 16. 1. 9. 1. 1. Using the net ads join and net rpc join Commands
- 16. 1. 9. 1. 2. Using the net rpc rights Command
- 16. 1. 9. 1. 3. Using the net rpc share Command
- 16. 1. 9. 1. 4. Using the net user Command
- 16. 1. 9. 1. 5. Using the net usershare Command
- 16. 1. 9. 2. Using the rpcclient Utility
- 16. 1. 9. 3. Using the samba-regedit Application
- 16. 1. 9. 4. Using the smbcacls Utility
- 16. 1. 9. 5. Using the smbclient Utility Expand section "16. 1. 9. 5. Using the smbclient Utility" Collapse section "16. 1. 9. 5. Using the smbclient Utility"
- 16. 1. 9. 5. 1. Using smbclient in Interactive Mode
- 16. 1. 9. 5. 2. Using smbclient in Scripting Mode
- 16. 1. 9. 6. Using the smbcontrol Utility
- 16. 1. 9. 7. Using the smbpasswd Utility
- 16. 1. 9. 8. Using the smbstatus Utility
- 16. 1. 9. 9. Using the smbtar Utility
- 16. 1. 9. 10. Using the testparm Utility
- 16. 1. 9. 11. Using the wbinfo Utility
- 16. 1. 9. 1. Using the net Utility Expand section "16. 1. 9. 1. Using the net Utility" Collapse section "16. 1. 9. 1. Using the net Utility"
- 16. 1. 10. Additional Resources
- 16. 2. FTP Expand section "16. 2. FTP" Collapse section "16. 2. FTP"
- 16. 2. 1. The File Transfer Protocol
- 16. 2. 2. The vsftpd Server Expand section "16. 2. 2. The vsftpd Server" Collapse section "16. 2. 2. The vsftpd Server"
- 16. 2. 2. 1. Starting and Stopping vsftpd
- 16. 2. 2. 2. Starting Multiple Copies of vsftpd
- 16. 2. 2. 3. Encrypting vsftpd Connections Using TLS
- 16. 2. 2. 4. SELinux Policy for vsftpd
- 16. 2. 3. Additional Resources Expand section "16. 2. 3. Additional Resources" Collapse section "16. 2. 3. Additional Resources"
- 16. 2. 3. 1. Installed Documentation
- 16. 2. 3. 2. Online Documentation
- 16. 3. Print Settings Expand section "16. 3. Print Settings" Collapse section "16. 3. Print Settings"
- 16. 3. 1. Starting the Print Settings Configuration Tool
- 16. 3. 2. Starting Printer Setup
- 16. 3. 3. Adding a Local Printer
- 16. 3. 4. Adding an AppSocket/HP JetDirect printer
- 16. 3. 5. Thêm một máy in IPP
- 16. 3. 6. Adding an LPD/LPR Host or Printer
- 16. 3. 7. Adding a Samba [SMB] printer
- 16. 3. 8. Selecting the Printer Model and Finishing
- 16. 3. 9. Printing a Test Page
- 16. 3. 10. Modifying Existing Printers Expand section "16. 3. 10. Modifying Existing Printers" Collapse section "16. 3. 10. Modifying Existing Printers"
- 16. 3. 10. 1. The Settings Page
- 16. 3. 10. 2. The Policies Page Expand section "16. 3. 10. 2. The Policies Page" Collapse section "16. 3. 10. 2. The Policies Page"
- 16. 3. 10. 2. 1. Sharing Printers
- 16. 3. 10. 2. 2. The Access Control Page
- 16. 3. 10. 2. 3. The Printer Options Page
- 16. 3. 10. 2. 4. Job Options Page
- 16. 3. 10. 2. 5. Ink/Toner Levels Page
- 16. 3. 10. 3. Managing Print Jobs
- 16. 3. 11. Additional Resources
- 16. 1. Samba Expand section "16. 1. Samba" Collapse section "16. 1. Samba"
- 17. Database Servers Expand section "17. Database Servers" Collapse section "17. Database Servers"
- 17. 1. MariaDB Expand section "17. 1. MariaDB" Collapse section "17. 1. MariaDB"
- 17. 1. 1. Installing the MariaDB server Expand section "17. 1. 1. Installing the MariaDB server" Collapse section "17. 1. 1. Installing the MariaDB server"
- 17. 1. 1. 1. Improving MariaDB installation security
- 17. 1. 2. Configuring the MariaDB server for networking
- 17. 1. 3. Backing up MariaDB data Expand section "17. 1. 3. Backing up MariaDB data" Collapse section "17. 1. 3. Backing up MariaDB data"
- 17. 1. 3. 1. Logical back up
- 17. 1. 3. 2. Physical back up
- 17. 1. 1. Installing the MariaDB server Expand section "17. 1. 1. Installing the MariaDB server" Collapse section "17. 1. 1. Installing the MariaDB server"
- 17. 1. MariaDB Expand section "17. 1. MariaDB" Collapse section "17. 1. MariaDB"
- 18. Configuring NTP Using the chrony Suite Expand section "18. Configuring NTP Using the chrony Suite" Collapse section "18. Configuring NTP Using the chrony Suite"
- 18. 1. Introduction to the chrony Suite Expand section "18. 1. Introduction to the chrony Suite" Collapse section "18. 1. Introduction to the chrony Suite"
- 18. 1. 1. Differences Between ntpd and chronyd
- 18. 1. 2. Choosing Between NTP Daemons
- 18. 2. Understanding chrony and Its Configuration Expand section "18. 2. Understanding chrony and Its Configuration" Collapse section "18. 2. Understanding chrony and Its Configuration"
- 18. 2. 1. Understanding chronyd and chronyc
- 18. 2. 2. Understanding the chrony Configuration Commands
- 18. 2. 3. Security with chronyc
- 18. 3. Using chrony Expand section "18. 3. Using chrony" Collapse section "18. 3. Using chrony"
- 18. 3. 1. Installing chrony
- 18. 3. 2. Checking the Status of chronyd
- 18. 3. 3. Starting chronyd
- 18. 3. 4. Stopping chronyd
- 18. 3. 5. Checking if chrony is Synchronized Expand section "18. 3. 5. Checking if chrony is Synchronized" Collapse section "18. 3. 5. Kiểm tra xem thời gian có được Đồng bộ hóa hay không"
- 18. 3. 5. 1. Checking chrony Tracking
- 18. 3. 5. 2. Checking chrony Sources
- 18. 3. 5. 3. Checking chrony Source Statistics
- 18. 3. 6. Manually Adjusting the System Clock
- 18. 4. Setting Up chrony for Different Environments Expand section "18. 4. Setting Up chrony for Different Environments" Collapse section "18. 4. Setting Up chrony for Different Environments"
- 18. 4. 1. Thiết lập đồng hồ bấm giờ cho Hệ thống trong Mạng biệt lập
- 18. 5. Using chronyc Expand section "18. 5. Using chronyc" Collapse section "18. 5. Using chronyc"
- 18. 5. 1. Using chronyc to Control chronyd
- 18. 6. Chrony with HW timestamping Expand section "18. 6. Chrony with HW timestamping" Collapse section "18. 6. Chrony with HW timestamping"
- 18. 6. 1. Understanding Hardware Timestamping
- 18. 6. 2. Verifying Support for Hardware Timestamping
- 18. 6. 3. Enabling Hardware Timestamping
- 18. 6. 4. Configuring Client Polling Interval
- 18. 6. 5. Enabling Interleaved Mode
- 18. 6. 6. Configuring Server for Large Number of Clients
- 18. 6. 7. Verifying Hardware Timestamping
- 18. 6. 8. Configuring PTP-NTP bridge
- 18. 7. Additional Resources Expand section "18. 7. Additional Resources" Collapse section "18. 7. Additional Resources"
- 18. 7. 1. Installed Documentation
- 18. 7. 2. Tài liệu trực tuyến
- 18. 1. Introduction to the chrony Suite Expand section "18. 1. Introduction to the chrony Suite" Collapse section "18. 1. Introduction to the chrony Suite"
- 19. Configuring NTP Using ntpd Expand section "19. Configuring NTP Using ntpd" Collapse section "19. Định cấu hình NTP bằng ntpd"
- 19. 1. Giới thiệu về NTP
- 19. 2. NTP Strata
- 19. 3. Understanding NTP
- 19. 4. Understanding the Drift File
- 19. 5. UTC, Timezones, and DST
- 19. 6. Authentication Options for NTP
- 19. 7. Managing the Time on Virtual Machines
- 19. 8. Understanding Leap Seconds
- 19. 9. Understanding the ntpd Configuration File
- 19. 10. Understanding the ntpd Sysconfig File
- 19. 11. Disabling chrony
- 19. 12. Checking if the NTP Daemon is Installed
- 19. 13. Installing the NTP Daemon [ntpd]
- 19. 14. Checking the Status of NTP
- 19. 15. Configure the Firewall to Allow Incoming NTP Packets Expand section "19. 15. Configure the Firewall to Allow Incoming NTP Packets" Collapse section "19. 15. Configure the Firewall to Allow Incoming NTP Packets"
- 19. 15. 1. Change the Firewall Settings
- 19. 15. 2. Open Ports in the Firewall for NTP Packets
- 19. 16. Configure ntpdate Servers
- 19. 17. Configure NTP Expand section "19. 17. Định cấu hình NTP" Thu gọn phần "19. 17. Định cấu hình NTP"
- 19. 17. 1. Định cấu hình Kiểm soát truy cập cho Dịch vụ NTP
- 19. 17. 2. Định cấu hình quyền truy cập giới hạn tốc độ vào dịch vụ NTP
- 19. 17. 3. Adding a Peer Address
- 19. 17. 4. Thêm địa chỉ máy chủ
- 19. 17. 5. Thêm địa chỉ máy chủ phát sóng hoặc phát đa hướng
- 19. 17. 6. Adding a Manycast Client Address
- 19. 17. 7. Adding a Broadcast Client Address
- 19. 17. 8. Adding a Manycast Server Address
- 19. 17. 9. Adding a Multicast Client Address
- 19. 17. 10. Configuring the Burst Option
- 19. 17. 11. Configuring the iburst Option
- 19. 17. 12. Configuring Symmetric Authentication Using a Key
- 19. 17. 13. Configuring the Poll Interval
- 19. 17. 14. Configuring Server Preference
- 19. 17. 15. Configuring the Time-to-Live for NTP Packets
- 19. 17. 16. Configuring the NTP Version to Use
- 19. 18. Configuring the Hardware Clock Update
- 19. 19. Configuring Clock Sources
- 19. 20. Additional Resources Expand section "19. 20. Additional Resources" Collapse section "19. 20. Additional Resources"
- 19. 20. 1. Installed Documentation
- 19. 20. 2. Useful Websites
- 20. Configuring PTP Using ptp4l Expand section "20. Configuring PTP Using ptp4l" Collapse section "20. Configuring PTP Using ptp4l"
- 20. 1. Introduction to PTP Expand section "20. 1. Introduction to PTP" Collapse section "20. 1. Introduction to PTP"
- 20. 1. 1. Understanding PTP
- 20. 1. 2. Advantages of PTP
- 20. 2. Using PTP Expand section "20. 2. Using PTP" Collapse section "20. 2. Using PTP"
- 20. 2. 1. Checking for Driver and Hardware Support
- 20. 2. 2. Installing PTP
- 20. 2. 3. Starting ptp4l Expand section "20. 2. 3. Starting ptp4l" Collapse section "20. 2. 3. Starting ptp4l"
- 20. 2. 3. 1. Selecting a Delay Measurement Mechanism
- 20. 3. Using PTP with Multiple Interfaces
- 20. 4. Chỉ định tệp cấu hình
- 20. 5. Using the PTP Management Client
- 20. 6. Synchronizing the Clocks
- 20. 7. Verifying Time Synchronization
- 20. 8. Serving PTP Time with NTP
- 20. 9. Serving NTP Time with PTP
- 20. 10. Synchronize to PTP or NTP Time Using timemaster Expand section "20. 10. Synchronize to PTP or NTP Time Using timemaster" Collapse section "20. 10. Synchronize to PTP or NTP Time Using timemaster"
- 20. 10. 1. Starting timemaster as a Service
- 20. 10. 2. Understanding the timemaster Configuration File
- 20. 10. 3. Configuring timemaster Options
- 20. 11. Improving Accuracy
- 20. 12. Additional Resources Expand section "20. 12. Additional Resources" Collapse section "20. 12. Additional Resources"
- 20. 12. 1. Installed Documentation
- 20. 12. 2. Useful Websites
- 20. 1. Introduction to PTP Expand section "20. 1. Introduction to PTP" Collapse section "20. 1. Introduction to PTP"
- 21. Công cụ giám sát hệ thống Mở rộng phần "21. System Monitoring Tools" Collapse section "21. System Monitoring Tools"
- 21. 1. Viewing System Processes Expand section "21. 1. Viewing System Processes" Collapse section "21. 1. Viewing System Processes"
- 21. 1. 1. Using the ps Command
- 21. 1. 2. Using the top Command
- 21. 1. 3. Using the System Monitor Tool
- 21. 2. Viewing Memory Usage Expand section "21. 2. Viewing Memory Usage" Collapse section "21. 2. Viewing Memory Usage"
- 21. 2. 1. Using the free Command
- 21. 2. 2. Using the System Monitor Tool
- 21. 3. Viewing CPU Usage Expand section "21. 3. Viewing CPU Usage" Collapse section "21. 3. Viewing CPU Usage"
- 21. 3. 1. Using the System Monitor Tool
- 21. 4. Viewing Block Devices and File Systems Expand section "21. 4. Viewing Block Devices and File Systems" Collapse section "21. 4. Viewing Block Devices and File Systems"
- 21. 4. 1. Using the lsblk Command
- 21. 4. 2. Using the blkid Command
- 21. 4. 3. Using the findmnt Command
- 21. 4. 4. Using the df Command
- 21. 4. 5. Using the du Command
- 21. 4. 6. Using the System Monitor Tool
- 21. 5. Viewing Hardware Information Expand section "21. 5. Viewing Hardware Information" Collapse section "21. 5. Viewing Hardware Information"
- 21. 5. 1. Using the lspci Command
- 21. 5. 2. Using the lsusb Command
- 21. 5. 3. Using the lscpu Command
- 21. 6. Kiểm tra lỗi phần cứng
- 21. 7. Monitoring Performance with Net-SNMP Expand section "21. 7. Monitoring Performance with Net-SNMP" Collapse section "21. 7. Monitoring Performance with Net-SNMP"
- 21. 7. 1. Installing Net-SNMP
- 21. 7. 2. Running the Net-SNMP Daemon Expand section "21. 7. 2. Running the Net-SNMP Daemon" Collapse section "21. 7. 2. Running the Net-SNMP Daemon"
- 21. 7. 2. 1. Starting the Service
- 21. 7. 2. 2. Stopping the Service
- 21. 7. 2. 3. Restarting the Service
- 21. 7. 3. Định cấu hình Net-SNMP Mở rộng phần "21. 7. 3. Configuring Net-SNMP" Collapse section "21. 7. 3. Configuring Net-SNMP"
- 21. 7. 3. 1. Setting System Information
- 21. 7. 3. 2. Configuring Authentication
- 21. 7. 4. Retrieving Performance Data over SNMP Expand section "21. 7. 4. Retrieving Performance Data over SNMP" Collapse section "21. 7. 4. Retrieving Performance Data over SNMP"
- 21. 7. 4. 1. Hardware Configuration
- 21. 7. 4. 2. CPU and Memory Information
- 21. 7. 4. 3. File System and Disk Information
- 21. 7. 4. 4. Network Information
- 21. 7. 5. Extending Net-SNMP Expand section "21. 7. 5. Extending Net-SNMP" Collapse section "21. 7. 5. Extending Net-SNMP"
- 21. 7. 5. 1. Extending Net-SNMP with Shell Scripts
- 21. 7. 5. 2. Extending Net-SNMP with Perl
- 21. 8. Additional Resources Expand section "21. 8. Additional Resources" Collapse section "21. 8. Additional Resources"
- 21. 8. 1. Installed Documentation
- 21. 1. Viewing System Processes Expand section "21. 1. Viewing System Processes" Collapse section "21. 1. Viewing System Processes"
- 22. OpenLMI Expand section "22. OpenLMI" Collapse section "22. OpenLMI"
- 22. 1. About OpenLMI Expand section "22. 1. About OpenLMI" Collapse section "22. 1. About OpenLMI"
- 22. 1. 1. Main Features
- 22. 1. 2. Management Capabilities
- 22. 2. Installing OpenLMI Expand section "22. 2. Installing OpenLMI" Collapse section "22. 2. Installing OpenLMI"
- 22. 2. 1. Installing OpenLMI on a Managed System
- 22. 2. 2. Installing OpenLMI on a Client System
- 22. 3. Configuring SSL Certificates for OpenPegasus Expand section "22. 3. Configuring SSL Certificates for OpenPegasus" Collapse section "22. 3. Configuring SSL Certificates for OpenPegasus"
- 22. 3. 1. Managing Self-signed Certificates
- 22. 3. 2. Managing Authority-signed Certificates with Identity Management [Recommended]
- 22. 3. 3. Managing Authority-signed Certificates Manually
- 22. 4. Using LMIShell Expand section "22. 4. Using LMIShell" Collapse section "22. 4. Using LMIShell"
- 22. 4. 1. Starting, Using, and Exiting LMIShell
- 22. 4. 2. Connecting to a CIMOM
- 22. 4. 3. Working with Namespaces
- 22. 4. 4. Working with Classes
- 22. 4. 5. Working with Instances
- 22. 4. 6. Working with Instance Names
- 22. 4. 7. Working with Associated Objects
- 22. 4. 8. Working with Association Objects
- 22. 4. 9. Working with Indications
- 22. 4. 10. Example Usage
- 22. 5. Using OpenLMI Scripts
- 22. 6. Tài nguyên bổ sung
- 22. 1. About OpenLMI Expand section "22. 1. About OpenLMI" Collapse section "22. 1. About OpenLMI"
- 23. Viewing and Managing Log Files Expand section "23. Viewing and Managing Log Files" Collapse section "23. Viewing and Managing Log Files"
- 23. 1. Locating Log Files
- 23. 2. Basic Configuration of Rsyslog Expand section "23. 2. Basic Configuration of Rsyslog" Collapse section "23. 2. Basic Configuration of Rsyslog"
- 23. 2. 1. Filters
- 23. 2. 2. Actions
- 23. 2. 3. mẫu
- 23. 2. 4. Global Directives
- 23. 2. 5. Log Rotation
- 23. 2. 6. Increasing the Limit of Open Files
- 23. 3. Sử dụng Định dạng Cấu hình Mới Mở rộng phần "23. 3. Using the New Configuration Format" Collapse section "23. 3. Using the New Configuration Format"
- 23. 3. 1. Rulesets
- 23. 3. 2. Compatibility with sysklogd
- 23. 4. Working with Queues in Rsyslog Expand section "23. 4. Working with Queues in Rsyslog" Collapse section "23. 4. Làm việc với Hàng đợi trong Rsyslog"
- 23. 4. 1. Defining Queues
- 23. 4. 2. Tạo một thư mục mới cho tệp nhật ký rsyslog
- 23. 4. 3. Quản lý hàng đợi
- 23. 4. 4. Using the New Syntax for rsyslog queues
- 23. 5. Định cấu hình rsyslog trên Máy chủ ghi nhật ký Mở rộng phần "23. 5. Định cấu hình rsyslog trên Máy chủ ghi nhật ký" Thu gọn phần "23. 5. Định cấu hình rsyslog trên Máy chủ ghi nhật ký"
- 23. 5. 1. Using The New Template Syntax on a Logging Server
- 23. 6. Using Rsyslog Modules Expand section "23. 6. Using Rsyslog Modules" Collapse section "23. 6. Sử dụng Mô-đun Rsyslog"
- 23. 6. 1. Importing Text Files
- 23. 6. 2. Exporting Messages to a Database
- 23. 6. 3. Enabling Encrypted Transport
- 23. 6. 4. Using RELP
- 23. 7. Interaction of Rsyslog and Journal
- 23. 8. Structured Logging with Rsyslog Expand section "23. 8. Structured Logging with Rsyslog" Collapse section "23. 8. Structured Logging with Rsyslog"
- 23. 8. 1. Importing Data from Journal
- 23. 8. 2. Filtering Structured Messages
- 23. 8. 3. Parsing JSON
- 23. 8. 4. Storing Messages in the MongoDB
- 23. 9. Debugging Rsyslog
- 23. 10. Using the Journal Expand section "23. 10. Using the Journal" Collapse section "23. 10. Using the Journal"
- 23. 10. 1. Viewing Log Files
- 23. 10. 2. Access Control
- 23. 10. 3. Sử dụng Chế độ xem trực tiếp
- 23. 10. 4. Filtering Messages
- 23. 10. 5. Kích hoạt lưu trữ liên tục
- 23. 11. Quản lý tệp nhật ký trong môi trường đồ họa Mở rộng phần "23. 11. Managing Log Files in a Graphical Environment" Collapse section "23. 11. Managing Log Files in a Graphical Environment"
- 23. 11. 1. Viewing Log Files
- 23. 11. 2. Thêm tệp nhật ký
- 23. 11. 3. Giám sát tệp nhật ký
- 23. 12. Additional Resources
- 24. Automating System Tasks Expand section "24. Automating System Tasks" Collapse section "24. Automating System Tasks"
- 24. 1. Scheduling a Recurring Job Using Cron Expand section "24. 1. Scheduling a Recurring Job Using Cron" Collapse section "24. 1. Scheduling a Recurring Job Using Cron"
- 24. 1. 1. Prerequisites for Cron Jobs
- 24. 1. 2. Scheduling a Cron Job
- 24. 2. Scheduling a Recurring Asynchronous Job Using Anacron Expand section "24. 2. Scheduling a Recurring Asynchronous Job Using Anacron" Collapse section "24. 2. Scheduling a Recurring Asynchronous Job Using Anacron"
- 24. 2. 1. Prerequisites for Anacrob Jobs
- 24. 2. 2. Scheduling an Anacron Job
- 24. 3. Scheduling a Job to Run at a Specific Time Using at Expand section "24. 3. Scheduling a Job to Run at a Specific Time Using at" Collapse section "24. 3. Scheduling a Job to Run at a Specific Time Using at"
- 24. 3. 1. Prerequisites for At Jobs
- 24. 3. 2. Scheduling an At Job Expand section "24. 3. 2. Scheduling an At Job" Collapse section "24. 3. 2. Lên lịch cho một công việc"
- 24. 3. 2. 1. Controlling Access to At and Batch
- 24. 4. Scheduling a Job to Run on System Load Drop Using batch Expand section "24. 4. Scheduling a Job to Run on System Load Drop Using batch" Collapse section "24. 4. Scheduling a Job to Run on System Load Drop Using batch"
- 24. 4. 1. Prerequisites for Batch Jobs
- 24. 4. 2. Scheduling a Batch Job
- 24. 5. Scheduling a Job to Run on Next Boot Using a systemd Unit File
- 24. 6. Additional Resources
- 24. 1. Scheduling a Recurring Job Using Cron Expand section "24. 1. Scheduling a Recurring Job Using Cron" Collapse section "24. 1. Scheduling a Recurring Job Using Cron"
- 25. Automatic Bug Reporting Tool [ABRT] Expand section "25. Automatic Bug Reporting Tool [ABRT]" Collapse section "25. Automatic Bug Reporting Tool [ABRT]"
- 25. 1. Introduction to ABRT
- 25. 2. Installing ABRT and Starting its Services Expand section "25. 2. Installing ABRT and Starting its Services" Collapse section "25. 2. Installing ABRT and Starting its Services"
- 25. 2. 1. Installing the ABRT GUI
- 25. 2. 2. Installing ABRT for the Command Line
- 25. 2. 3. Installing Supplementary ABRT Tools
- 25. 2. 4. Starting the ABRT Services
- 25. 2. 5. Testing ABRT Crash Detection
- 25. 3. Configuring ABRT Expand section "25. 3. Configuring ABRT" Collapse section "25. 3. Configuring ABRT"
- 25. 3. 1. Configuring Events
- 25. 3. 2. Creating Custom Events
- 25. 3. 3. Setting Up Automatic Reporting
- 25. 4. Detecting Software Problems Expand section "25. 4. Detecting Software Problems" Collapse section "25. 4. Detecting Software Problems"
- 25. 4. 1. Detecting C and C++ Crashes
- 25. 4. 2. Detecting Python Exceptions
- 25. 4. 3. Detecting Ruby Exceptions
- 25. 4. 4. Detecting Java Exceptions
- 25. 4. 5. Detecting X. Org Crashes
- 25. 4. 6. Detecting Kernel Oopses and Panics
- 25. 5. Handling Detected Problems Expand section "25. 5. Xử lý sự cố đã phát hiện" Thu gọn phần "25. 5. Xử lý sự cố đã phát hiện"
- 25. 5. 1. Using the Command Line Tool
- 25. 5. 2. Using the GUI
- 25. 6. Additional Resources
- 26. Working with GRUB 2 Expand section "26. Working with GRUB 2" Collapse section "26. Working with GRUB 2"
- 26. 1. Introduction to GRUB 2
- 26. 2. Configuring GRUB 2
- 26. 3. Making Temporary Changes to a GRUB 2 Menu
- 26. 4. Making Persistent Changes to a GRUB 2 Menu Using the grubby Tool
- 26. 5. Customizing the GRUB 2 Configuration File Expand section "26. 5. Customizing the GRUB 2 Configuration File" Collapse section "26. 5. Customizing the GRUB 2 Configuration File"
- 26. 5. 1. Changing the Default Boot Entry
- 26. 5. 2. Editing a Menu Entry
- 26. 5. 3. Adding a new Entry
- 26. 5. 4. Creating a Custom Menu
- 26. 6. Protecting GRUB 2 with a Password
- 26. 7. Reinstalling GRUB 2 Expand section "26. 7. Reinstalling GRUB 2" Collapse section "26. 7. Reinstalling GRUB 2"
- 26. 7. 1. Reinstalling GRUB 2 on BIOS-Based Machines
- 26. 7. 2. Reinstalling GRUB 2 on UEFI-Based Machines
- 26. 7. 3. Resetting and Reinstalling GRUB 2
- 26. 8. Upgrading from GRUB Legacy to GRUB 2
- 26. 9. GRUB 2 over a Serial Console Expand section "26. 9. GRUB 2 over a Serial Console" Collapse section "26. 9. GRUB 2 over a Serial Console"
- 26. 9. 1. Configuring GRUB 2 for a single boot
- 26. 9. 2. Configuring GRUB 2 for a persistent change
- 26. 9. 3. Configuring a new GRUB 2 file
- 26. 9. 4. Using screen to Connect to the Serial Console
- 26. 10. Terminal Menu Editing During Boot Expand section "26. 10. Terminal Menu Editing During Boot" Collapse section "26. 10. Terminal Menu Editing During Boot"
- 26. 10. 1. Booting to Rescue Mode
- 26. 10. 2. Booting to Emergency Mode
- 26. 10. 3. Booting to the Debug Shell
- 26. 10. 4. Changing and Resetting the Root Password
- 26. 11. Khởi động an toàn Giao diện phần sụn mở rộng hợp nhất [UEFI] Mở rộng phần "26. 11. Unified Extensible Firmware Interface [UEFI] Secure Boot" Collapse section "26. 11. Unified Extensible Firmware Interface [UEFI] Secure Boot"
- 26. 11. 1. UEFI Secure Boot Support in Red Hat Enterprise Linux 7
- 26. 12. Additional Resources
- 27. Relax-and-Recover [ReaR] Expand section "27. Relax-and-Recover [ReaR]" Collapse section "27. Relax-and-Recover [ReaR]"
- 27. 1. Basic ReaR Usage Expand section "27. 1. Basic ReaR Usage" Collapse section "27. 1. Basic ReaR Usage"
- 27. 1. 1. Installing ReaR
- 27. 1. 2. Configuring ReaR
- 27. 1. 3. Creating a Rescue System
- 27. 1. 4. Scheduling ReaR
- 27. 1. 5. Performing a System Rescue
- 27. 2. Integrating ReaR with Backup Software Expand section "27. 2. Integrating ReaR with Backup Software" Collapse section "27. 2. Integrating ReaR with Backup Software"
- 27. 2. 1. The Built-in Backup Method Expand section "27. 2. 1. The Built-in Backup Method" Collapse section "27. 2. 1. The Built-in Backup Method"
- 27. 2. 1. 1. Configuring the Internal Backup Method
- 27. 2. 1. 2. Creating a Backup Using the Internal Backup Method
- 27. 2. 2. Supported Backup Methods
- 27. 2. 3. Unsupported Backup Methods
- 27. 2. 4. Creating Multiple Backups
- 27. 2. 1. The Built-in Backup Method Expand section "27. 2. 1. The Built-in Backup Method" Collapse section "27. 2. 1. The Built-in Backup Method"
- 27. 1. Basic ReaR Usage Expand section "27. 1. Basic ReaR Usage" Collapse section "27. 1. Basic ReaR Usage"
- 28. Choosing Suitable Red Hat Product
- 29. Red Hat Customer Portal Labs Relevant to System Administration
- 30. Revision History Expand section "30. Revision History" Collapse section "30. Revision History"
- 30. 1. Acknowledgments
- Language. Language
- 日本語
- 简体中文
- English
- Français
- Format. Format
- Multi-page
- Single-page
- ePub
Language and Page Formatting Options
- Language. Language
- 日本語
- 简体中文
- English
- Français
- Format. Format
- Multi-page
- Single-page
- ePub
Red Hat Training
A Red Hat training course is available for Red Hat Enterprise Linux
Chapter 10. Managing Services with systemd
10. 1. Introduction to systemd
Systemd là trình quản lý dịch vụ và hệ thống dành cho hệ điều hành Linux. It is designed to be backwards compatible with SysV init scripts, and provides a number of features such as parallel startup of system services at boot time, on-demand activation of daemons, or dependency-based service control logic. In Red Hat Enterprise Linux 7, systemd replaces Upstart as the default init system.
Systemd introduces the concept of systemd units . These units are represented by unit configuration files located in one of the directories listed in Table 10. 2, “Systemd Unit Files Locations”, and encapsulate information about system services, listening sockets, and other objects that are relevant to the init system. For a complete list of available systemd unit types, see Table 10. 1, “Các loại đơn vị systemd có sẵn”.
Table 10. 1. Available systemd Unit Types
Unit TypeFile ExtensionDescription
Service unit
~]# systemctl stop nfs-server.service08
A system service
Target unit
~]# systemctl stop nfs-server.service09
A group of systemd units
Automount unit
~]# systemctl stop nfs-server.service10
A file system automount point
Device unit
~]# systemctl stop nfs-server.service11
A device file recognized by the kernel
Mount unit
~]# systemctl stop nfs-server.service12
A file system mount point
Path unit
~]# systemctl stop nfs-server.service13
A file or directory in a file system
Scope unit
~]# systemctl stop nfs-server.service14
An externally created process
Slice unit
~]# systemctl stop nfs-server.service15
A group of hierarchically organized units that manage system processes
Snapshot unit
~]# systemctl stop nfs-server.service16
A saved state of the systemd manager
Socket unit
~]# systemctl stop nfs-server.service17
An inter-process communication socket
Swap unit
~]# systemctl stop nfs-server.service18
A swap device or a swap file
Timer unit
~]# systemctl stop nfs-server.service19
A systemd timer
Table 10. 2. Systemd Unit Files Locations
DirectoryDescription
~]# systemctl stop nfs-server.service20
Systemd unit files distributed with installed RPM packages
~]# systemctl stop nfs-server.service21
Systemd unit files created at run time. This directory takes precedence over the directory with installed service unit files
~]# systemctl stop nfs-server.service22
Systemd unit files created by
~]# systemctl stop nfs-server.service23 as well as unit files added for extending a service. This directory takes precedence over the directory with runtime unit files
Overriding the Default systemd Configuration Using system. conf
The default configuration of systemd is defined during the compilation and it can be found in systemd configuration file at
~]# systemctl stop nfs-server.service24. Use this file if you want to deviate from those defaults and override selected default values for systemd units globally
For example, to override the default value of the timeout limit, which is set to 90 seconds, use the
~]# systemctl stop nfs-server.service25 parameter to input the required value in seconds
~]# systemctl stop nfs-server.service8
See also Example 10. 21, “Changing the timeout limit”
10. 1. 1. Main Features
In Red Hat Enterprise Linux 7, the systemd system and service manager provides the following main features
Socket-based activation — At boot time, systemd creates listening sockets for all system services that support this type of activation, and passes the sockets to these services as soon as they are started. Điều này không chỉ cho phép systemd bắt đầu các dịch vụ song song mà còn cho phép khởi động lại một dịch vụ mà không làm mất bất kỳ tin nhắn nào được gửi tới nó khi nó không khả dụng. the corresponding socket remains accessible and all messages are queued.
Systemd uses socket units for socket-based activation.
- Bus-based activation — System services that use D-Bus for inter-process communication can be started on-demand the first time a client application attempts to communicate with them. Systemd uses D-Bus service files for bus-based activation.
- Device-based activation — System services that support device-based activation can be started on-demand when a particular type of hardware is plugged in or becomes available. Systemd uses device units for device-based activation.
- Path-based activation — System services that support path-based activation can be started on-demand when a particular file or directory changes its state. Systemd uses path units for path-based activation.
- Mount and automount point management — Systemd monitors and manages mount and automount points. Systemd uses mount units for mount points and automount units for automount points.
- Aggressive parallelization — Because of the use of socket-based activation, systemd can start system services in parallel as soon as all listening sockets are in place. In combination with system services that support on-demand activation, parallel activation significantly reduces the time required to boot the system.
- Transactional unit activation logic — Before activating or deactivating a unit, systemd calculates its dependencies, creates a temporary transaction, and verifies that this transaction is consistent. If a transaction is inconsistent, systemd automatically attempts to correct it and remove non-essential jobs from it before reporting an error.
- Backwards compatibility with SysV init — Systemd supports SysV init scripts as described in the Linux Standard Base Core Specification , which eases the upgrade path to systemd service units.
10. 1. 2. Compatibility Changes
The systemd system and service manager is designed to be mostly compatible with SysV init and Upstart. The following are the most notable compatibility changes with regards to the previous major release of the Red Hat Enterprise Linux system
Systemd has only limited support for runlevels. It provides a number of target units that can be directly mapped to these runlevels and for compatibility reasons, it is also distributed with the earlier
~]# systemctl stop nfs-server.service
26 command. Not all systemd targets can be directly mapped to runlevels, however, and as a consequence, this command might return~]# systemctl stop nfs-server.service
27 to indicate an unknown runlevel. It is recommended that you avoid using the~]# systemctl stop nfs-server.service
26 command if possibleFor more information about systemd targets and their comparison with runlevels, see Section 10. 3, “Working with systemd Targets”
The
~]# systemctl stop nfs-server.service
29 utility does not support custom commands. In addition to standard commands such as~]# systemctl stop nfs-server.service
30,~]# systemctl stop nfs-server.service
31, and~]# systemctl stop nfs-server.service
32, authors of SysV init scripts could implement support for any number of arbitrary commands in order to provide additional functionality. For example, the init script for~]# systemctl stop nfs-server.service
33 in Red Hat Enterprise Linux 6 could be executed with the~]# systemctl stop nfs-server.service
34 command, which immediately enabled panic mode and reconfigured the system to start dropping all incoming and outgoing packets. This is not supported in systemd and the~]# systemctl stop nfs-server.service
29 only accepts documented commandsFor more information about the
~]# systemctl stop nfs-server.service
29 utility and its comparison with the earlier~]# systemctl stop nfs-server.service
37 utility, see Section 10. 2, “Managing System Services”- The
~]# systemctl stop nfs-server.service
29 utility does not communicate with services that have not been started by systemd. When systemd starts a system service, it stores the ID of its main process in order to keep track of it. The~]# systemctl stop nfs-server.service
29 utility then uses this PID to query and manage the service. Consequently, if a user starts a particular daemon directly on the command line,~]# systemctl stop nfs-server.service
29 is unable to determine its current status or stop it - Systemd stops only running services. Previously, when the shutdown sequence was initiated, Red Hat Enterprise Linux 6 and earlier releases of the system used symbolic links located in the
~]# systemctl stop nfs-server.service
41 directory to stop all available system services regardless of their status. With systemd, only running services are stopped on shutdown - System services are unable to read from the standard input stream. When systemd starts a service, it connects its standard input to
~]# systemctl stop nfs-server.service
42 to prevent any interaction with the user - System services do not inherit any context [such as the
~]# systemctl stop nfs-server.service
43 and~]# systemctl stop nfs-server.service
44 environment variables] from the invoking user and their session. Each service runs in a clean execution context - When loading a SysV init script, systemd reads dependency information encoded in the Linux Standard Base [LSB] header and interprets it at run time
- Tất cả các hoạt động trên các đơn vị dịch vụ phải tuân theo thời gian chờ mặc định là 5 phút để ngăn dịch vụ bị trục trặc đóng băng hệ thống. Giá trị này được mã hóa cứng cho các dịch vụ được tạo từ initscripts và không thể thay đổi. However, individual configuration files can be used to specify a longer timeout value per service, see Example 10. 21, “Changing the timeout limit”
For a detailed list of compatibility changes introduced with systemd, see the Migration Planning Guide for Red Hat Enterprise Linux 7
10. 2. Managing System Services
Note
To expand your expertise, you might also be interested in the Red Hat System Administration II [RH134] training course
Previous versions of Red Hat Enterprise Linux, which were distributed with SysV init or Upstart, used init scripts located in the
~]# systemctl stop nfs-server.service45 directory. These init scripts were typically written in Bash, and allowed the system administrator to control the state of services and daemons in their system. In Red Hat Enterprise Linux 7, these init scripts have been replaced with service units .
Service units end with the
~]# systemctl stop nfs-server.service08 file extension and serve a similar purpose as init scripts. To view, start, stop, restart, enable, or disable system services, use the
~]# systemctl stop nfs-server.service29 command as described in Table 10. 3, “Comparison of the service Utility with systemctl”, Table 10. 4, “Comparison of the chkconfig Utility with systemctl”, and further in this section. The
~]# systemctl stop nfs-server.service37 and
~]# systemctl stop nfs-server.service49 commands are still available in the system and work as expected, but are only included for compatibility reasons and should be avoided
Table 10. 3. Comparison of the service Utility with systemctl
servicesystemctlDescription
~]# systemctl stop nfs-server.service50
~]# systemctl stop nfs-server.service51
Starts a service
~]# systemctl stop nfs-server.service52
~]# systemctl stop nfs-server.service53
Stops a service
~]# systemctl stop nfs-server.service54
~]# systemctl stop nfs-server.service55
Restarts a service
~]# systemctl stop nfs-server.service56
~]# systemctl stop nfs-server.service57
Restarts a service only if it is running
~]# systemctl stop nfs-server.service58
~]# systemctl stop nfs-server.service59
Reloads configuration
~]# systemctl stop nfs-server.service60
~]# systemctl stop nfs-server.service61
~]# systemctl stop nfs-server.service62
Checks if a service is running
~]# systemctl stop nfs-server.service63
~]# systemctl stop nfs-server.service64
Displays the status of all services
Table 10. 4. Comparison of the chkconfig Utility with systemctl
chkconfigsystemctlDescription
~]# systemctl stop nfs-server.service65
~]# systemctl stop nfs-server.service66
Enables a service
~]# systemctl stop nfs-server.service67
~]# systemctl stop nfs-server.service68
Disables a service
~]# systemctl stop nfs-server.service69
~]# systemctl stop nfs-server.service61
~]# systemctl stop nfs-server.service71
Checks if a service is enabled
~]# systemctl stop nfs-server.service72
~]# systemctl stop nfs-server.service73
Lists all services and checks if they are enabled
~]# systemctl stop nfs-server.service72
~]# systemctl stop nfs-server.service75
Lists services that are ordered to start before the specified unit
~]# systemctl stop nfs-server.service72
~]# systemctl stop nfs-server.service77
Lists services that are ordered to start after the specified unit
Specifying Service Units
For clarity, all command examples in the rest of this section use full unit names with the
~]# systemctl stop nfs-server.service08 file extension, for example
~]# systemctl stop nfs-server.service
However, the file extension can be omitted, in which case the
~]# systemctl stop nfs-server.service29 utility assumes the argument is a service unit. The following command is equivalent to the one above
~]# systemctl stop nfs-server.service4
Additionally, some units have alias names. Those names can have shorter names than units, which can be used instead of the actual unit names. To find all aliases that can be used for a particular unit, use
~]# systemctl stop nfs-server.service5
Behavior of systemctl in a chroot Environment
If you change the root directory using the
~]# systemctl stop nfs-server.service80 command, most
~]# systemctl stop nfs-server.service29 commands refuse to perform any action. The reason for this is that the
~]# systemctl stop nfs-server.service82 process and the user that used the
~]# systemctl stop nfs-server.service80 command do not have the same view of the filesystem. This happens, for example, when
~]# systemctl stop nfs-server.service29 is invoked from a
~]# systemctl stop nfs-server.service85 file
The exception to this are unit file commands such as the
~]# systemctl stop nfs-server.service23 and
~]# systemctl stop nfs-server.service87 commands. These commands do not need a running system and do not affect running processes, but they do affect unit files. Therefore, you can run these commands even in
~]# systemctl stop nfs-server.service80 environment. For example, to enable the
~]# systemctl stop nfs-server.service89 service on a system under the
~]# systemctl stop nfs-server.service90 directory
~]# systemctl stop nfs-server.service7
10. 2. 1. Listing Services
To list all currently loaded service units, type the following at a shell prompt
~]# systemctl stop nfs-server.service8
Đối với mỗi tệp đơn vị dịch vụ, lệnh này hiển thị tên đầy đủ của nó [
~]# systemctl stop nfs-server.service91] theo sau là ghi chú liệu tệp đơn vị đã được tải chưa [
~]# systemctl stop nfs-server.service92], trạng thái kích hoạt tệp đơn vị cấp cao [
~]# systemctl stop nfs-server.service93] và cấp thấp [
~]# systemctl stop nfs-server.service94] và
By default, the
~]# systemctl stop nfs-server.service96 command displays only active units. If you want to list all loaded units regardless of their state, run this command with the
~]# systemctl stop nfs-server.service97 or
~]# systemctl stop nfs-server.service98 command line option
~]# systemctl stop nfs-server.service7
You can also list all available service units to see if they are enabled. To do so, type
~]# systemctl stop nfs-server.service8
For each service unit, this command displays its full name [
~]# systemctl stop nfs-server.service99] followed by information whether the service unit is enabled or not [
~]# systemctl stop nfs-server.service400]. For information on how to determine the status of individual service units, see Section 10. 2. 2, “Displaying Service Status”
Example 10. 1. Listing Services
To list all currently loaded service units, run the following command
~]# systemctl stop nfs-server.service01
To list all installed service unit files to determine if they are enabled, type
~]# systemctl stop nfs-server.service02
10. 2. 2. Displaying Service Status
To display detailed information about a service unit that corresponds to a system service, type the following at a shell prompt
~]# systemctl stop nfs-server.service0
Replace name with the name of the service unit you want to inspect [for example,
~]# systemctl stop nfs-server.service401]. This command displays the name of the selected service unit followed by its short description, one or more fields described in Table 10. 5, “Available Service Unit Information”, and if it is executed by the
~]# systemctl stop nfs-server.service402 user, also the most recent log entries.
Table 10. 5. Available Service Unit Information
FieldDescription
~]# systemctl stop nfs-server.service403
Information whether the service unit has been loaded, the absolute path to the unit file, and a note whether the unit is enabled
~]# systemctl stop nfs-server.service404
Information whether the service unit is running followed by a time stamp
~]# systemctl stop nfs-server.service405
The PID of the corresponding system service followed by its name
~]# systemctl stop nfs-server.service406
Additional information about the corresponding system service
~]# systemctl stop nfs-server.service407
Additional information about related processes
~]# systemctl stop nfs-server.service408
Additional information about related Control Groups [cgroups]
To only verify that a particular service unit is running, run the following command
~]# systemctl stop nfs-server.service1
Similarly, to determine whether a particular service unit is enabled, type
~]# systemctl stop nfs-server.service2
Note that both
~]# systemctl stop nfs-server.service409 and
~]# systemctl stop nfs-server.service410 return an exit status of
~]# systemctl stop nfs-server.service411 if the specified service unit is running or enabled. For information on how to list all currently loaded service units, see Section 10. 2. 1, “Listing Services”
Example 10. 2. Displaying Service Status
The service unit for the GNOME Display Manager is named
~]# systemctl stop nfs-server.service412. To determine the current status of this service unit, type the following at a shell prompt
~]# systemctl stop nfs-server.service3
Example 10. 3. Displaying Services Ordered to Start Before a Service
To determine what services are ordered to start before the specified service, type the following at a shell prompt
~]# systemctl stop nfs-server.service4
Example 10. 4. Displaying Services Ordered to Start After a Service
To determine what services are ordered to start after the specified service, type the following at a shell prompt
~]# systemctl stop nfs-server.service5
10. 2. 3. Starting a Service
To start a service unit that corresponds to a system service, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service6
Replace name with the name of the service unit you want to start [for example,
~]# systemctl stop nfs-server.service401]. This command starts the selected service unit in the current session. For information on how to enable a service unit to be started at boot time, see Section 10. 2. 6, “Enabling a Service”. Để biết thông tin về cách xác định trạng thái của một đơn vị dịch vụ nhất định, hãy xem Phần 10. 2. 2, “Displaying Service Status”.
Example 10. 5. Starting a Service
The service unit for the Apache HTTP Server is named
~]# systemctl stop nfs-server.service415. To activate this service unit and start the
~]# systemctl stop nfs-server.service89 daemon in the current session, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service7
10. 2. 4. Stopping a Service
To stop a service unit that corresponds to a system service, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service8
Replace name with the name of the service unit you want to stop [for example,
~]# systemctl stop nfs-server.service419]. This command stops the selected service unit in the current session. For information on how to disable a service unit and prevent it from being started at boot time, see Section 10. 2. 7, “Disabling a Service”. For information on how to determine the status of a certain service unit, see Section 10. 2. 2, “Displaying Service Status”.
Example 10. 6. Stopping a Service
The service unit for the
~]# systemctl stop nfs-server.service420 daemon is named
~]# systemctl stop nfs-server.service421. To deactivate this service unit and stop the
~]# systemctl stop nfs-server.service420 daemon in the current session, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service9
10. 2. 5. Restarting a Service
To restart a service unit that corresponds to a system service, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service40
Replace name with the name of the service unit you want to restart [for example,
~]# systemctl stop nfs-server.service89]. This command stops the selected service unit in the current session and immediately starts it again. Importantly, if the selected service unit is not running, this command starts it too. To tell systemd to restart a service unit only if the corresponding service is already running, run the following command as
~]# systemctl stop nfs-server.service402.
~]# systemctl stop nfs-server.service41
Certain system services also allow you to reload their configuration without interrupting their execution. To do so, type as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service42
Note that system services that do not support this feature ignore this command altogether. For convenience, the
~]# systemctl stop nfs-server.service29 command also supports the
~]# systemctl stop nfs-server.service429 and
~]# systemctl stop nfs-server.service430 commands that restart such services instead. For information on how to determine the status of a certain service unit, see Section 10. 2. 2, “Displaying Service Status”
Example 10. 7. Restarting a Service
In order to prevent users from encountering unnecessary error messages or partially rendered web pages, the Apache HTTP Server allows you to edit and reload its configuration without the need to restart it and interrupt actively processed requests. To do so, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service43
10. 2. 6. Enabling a Service
To configure a service unit that corresponds to a system service to be automatically started at boot time, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service44
Replace name with the name of the service unit you want to enable [for example,
~]# systemctl stop nfs-server.service89]. This command reads the
~]# systemctl stop nfs-server.service434 section of the selected service unit and creates appropriate symbolic links to the
~]# systemctl stop nfs-server.service435 file in the
~]# systemctl stop nfs-server.service22 directory and its subdirectories. This command does not, however, rewrite links that already exist. If you want to ensure that the symbolic links are re-created, use the following command as
~]# systemctl stop nfs-server.service402.
~]# systemctl stop nfs-server.service45
This command disables the selected service unit and immediately enables it again. For information on how to determine whether a certain service unit is enabled to start at boot time, see Section 10. 2. 2, “Hiển thị trạng thái dịch vụ”. For information on how to start a service in the current session, see Section 10. 2. 3, “Starting a Service”
Example 10. 8. Enabling a Service
To configure the Apache HTTP Server to start automatically at boot time, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service46
10. 2. 7. Disabling a Service
To prevent a service unit that corresponds to a system service from being automatically started at boot time, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service47
Replace name with the name of the service unit you want to disable [for example,
~]# systemctl stop nfs-server.service419]. This command reads the
~]# systemctl stop nfs-server.service434 section of the selected service unit and removes appropriate symbolic links to the
~]# systemctl stop nfs-server.service435 file from the
~]# systemctl stop nfs-server.service22 directory and its subdirectories. In addition, you can mask any service unit to prevent it from being started manually or by another service. To do so, run the following command as
~]# systemctl stop nfs-server.service402.
~]# systemctl stop nfs-server.service48
This command replaces the
~]# systemctl stop nfs-server.service445 file with a symbolic link to
~]# systemctl stop nfs-server.service42, rendering the actual unit file inaccessible to systemd. To revert this action and unmask a service unit, type as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service49
For information on how to determine whether a certain service unit is enabled to start at boot time, see Section 10. 2. 2, “Displaying Service Status”. For information on how to stop a service in the current session, see Section 10. 2. 4, “Stopping a Service”
Example 10. 9. Disabling a Service
Example 10. 6, “Stopping a Service” illustrates how to stop the
~]# systemctl stop nfs-server.service421 unit in the current session. To prevent this service unit from starting at boot time, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service50
10. 2. 8. Starting a Conflicting Service
In systemd , positive and negative dependencies between services exist. Starting particular service may require starting one or more other services [positive dependency] or stopping one or more services [negative dependency].
When you attempt to start a new service, systemd resolves all dependencies automatically. Note that this is done without explicit notification to the user. If you are already running a service, and you attempt to start another service with a negative dependency, the first service is automatically stopped.
For example, if you are running the
~]# systemctl stop nfs-server.service450 service, and you try to start the
~]# systemctl stop nfs-server.service451 service, systemd first automatically stops
~]# systemctl stop nfs-server.service450, because these two services are conflicting and cannot run on the same port.
10. 3. Working with systemd Targets
Previous versions of Red Hat Enterprise Linux, which were distributed with SysV init or Upstart, implemented a predefined set of runlevels that represented specific modes of operation. These runlevels were numbered from 0 to 6 and were defined by a selection of system services to be run when a particular runlevel was enabled by the system administrator. In Red Hat Enterprise Linux 7, the concept of runlevels has been replaced with systemd targets .
Systemd targets are represented by target units . Target units end with the
~]# systemctl stop nfs-server.service09 file extension and their only purpose is to group together other systemd units through a chain of dependencies. For example, the
~]# systemctl stop nfs-server.service454 unit, which is used to start a graphical session, starts system services such as the GNOME Display Manager [
~]# systemctl stop nfs-server.service412] or Accounts Service [
~]# systemctl stop nfs-server.service456] and also activates the
~]# systemctl stop nfs-server.service457 unit. Similarly, the
~]# systemctl stop nfs-server.service457 unit starts other essential system services such as NetworkManager [
~]# systemctl stop nfs-server.service459] or D-Bus [
~]# systemctl stop nfs-server.service460] and activates another target unit named
~]# systemctl stop nfs-server.service461.
Red Hat Enterprise Linux 7 is distributed with a number of predefined targets that are more or less similar to the standard set of runlevels from the previous releases of this system. For compatibility reasons, it also provides aliases for these targets that directly map them to SysV runlevels. Table 10. 6, “Comparison of SysV Runlevels with systemd Targets” provides a complete list of SysV runlevels and their corresponding systemd targets
Table 10. 6. Comparison of SysV Runlevels with systemd Targets
RunlevelTarget UnitsDescription
~]# systemctl stop nfs-server.service411
~]# systemctl stop nfs-server.service463,
~]# systemctl stop nfs-server.service464
Shut down and power off the system
~]# systemctl stop nfs-server.service465
~]# systemctl stop nfs-server.service466,
~]# systemctl stop nfs-server.service467
Set up a rescue shell
~]# systemctl stop nfs-server.service468
~]# systemctl stop nfs-server.service469,
~]# systemctl stop nfs-server.service457
Set up a non-graphical multi-user system
~]# systemctl stop nfs-server.service471
~]# systemctl stop nfs-server.service472,
~]# systemctl stop nfs-server.service457
Set up a non-graphical multi-user system
~]# systemctl stop nfs-server.service474
~]# systemctl stop nfs-server.service475,
~]# systemctl stop nfs-server.service457
Set up a non-graphical multi-user system
~]# systemctl stop nfs-server.service477
~]# systemctl stop nfs-server.service478,
~]# systemctl stop nfs-server.service454
Set up a graphical multi-user system
~]# systemctl stop nfs-server.service480
~]# systemctl stop nfs-server.service481,
~]# systemctl stop nfs-server.service482
Shut down and reboot the system
To view, change, or configure systemd targets, use the
~]# systemctl stop nfs-server.service29 utility as described in Table 10. 7, “Comparison of SysV init Commands with systemctl” and in the sections below. The
~]# systemctl stop nfs-server.service26 and
~]# systemctl stop nfs-server.service485 commands are still available in the system and work as expected, but are only included for compatibility reasons and should be avoided
Table 10. 7. Comparison of SysV init Commands with systemctl
Old CommandNew CommandDescription
~]# systemctl stop nfs-server.service26
~]# systemctl stop nfs-server.service487
Lists currently loaded target units
~]# systemctl stop nfs-server.service488
~]# systemctl stop nfs-server.service489
Changes the current target
10. 3. 1. Viewing the Default Target
To determine which target unit is used by default, run the following command
~]# systemctl stop nfs-server.service51
This command resolves the symbolic link located at
~]# systemctl stop nfs-server.service490 and displays the result. For information on how to change the default target, see Section 10. 3. 3, “Changing the Default Target”. For information on how to list all currently loaded target units, see Section 10. 3. 2, “Viewing the Current Target”
Example 10. 10. Viewing the Default Target
To display the default target unit, type
~]# systemctl stop nfs-server.service52
10. 3. 2. Viewing the Current Target
To list all currently loaded target units, type the following command at a shell prompt
~]# systemctl stop nfs-server.service53
For each target unit, this commands displays its full name [
~]# systemctl stop nfs-server.service91] followed by a note whether the unit has been loaded [
~]# systemctl stop nfs-server.service92], its high-level [
~]# systemctl stop nfs-server.service93] and low-level [
~]# systemctl stop nfs-server.service94] unit activation state, and a short description [
~]# systemctl stop nfs-server.service95]
By default, the
~]# systemctl stop nfs-server.service96 command displays only active units. If you want to list all loaded units regardless of their state, run this command with the
~]# systemctl stop nfs-server.service97 or
~]# systemctl stop nfs-server.service98 command line option
~]# systemctl stop nfs-server.service54
See Section 10. 3. 1, “Viewing the Default Target” for information on how to display the default target. For information on how to change the current target, see Section 10. 3. 4, “Changing the Current Target”
Ví dụ 10. 11. Viewing the Current Target
To list all currently loaded target units, run the following command
~]# systemctl stop nfs-server.service55
10. 3. 3. Changing the Default Target
To configure the system to use a different target unit by default, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service56
Replace name with the name of the target unit you want to use by default [for example,
~]# systemctl stop nfs-server.service500]. This command replaces the
~]# systemctl stop nfs-server.service490 file with a symbolic link to
~]# systemctl stop nfs-server.service502, where name is the name of the target unit you want to use. For information on how to change the current target, see Section 10. 3. 4, “Changing the Current Target”. For information on how to list all currently loaded target units, see Section 10. 3. 2, “Viewing the Current Target”.
Example 10. 12. Changing the Default Target
To configure the system to use the
~]# systemctl stop nfs-server.service457 unit by default, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service57
10. 3. 4. Changing the Current Target
To change to a different target unit in the current session, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service58
Replace name with the name of the target unit you want to use [for example,
~]# systemctl stop nfs-server.service500]. This command starts the target unit named name and all dependent units, and immediately stops all others. For information on how to change the default target, see Section 10. 3. 3, “Changing the Default Target”. For information on how to list all currently loaded target units, see Section 10. 3. 2, “Viewing the Current Target”.
Example 10. 13. Changing the Current Target
To turn off the graphical user interface and change to the
~]# systemctl stop nfs-server.service457 unit in the current session, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service59
10. 3. 5. Changing to Rescue Mode
Rescue mode provides a convenient single-user environment and allows you to repair your system in situations when it is unable to complete a regular booting process. In rescue mode, the system attempts to mount all local file systems and start some important system services, but it does not activate network interfaces or allow more users to be logged into the system at the same time. In Red Hat Enterprise Linux 7, rescue mode is equivalent to single user mode and requires the root password.
To change the current target and enter rescue mode in the current session, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service70
This command is similar to
~]# systemctl stop nfs-server.service510, but it also sends an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run this command with the
~]# systemctl stop nfs-server.service511 command line option
~]# systemctl stop nfs-server.service71
For information on how to enter emergency mode, see Section 10. 3. 6, “Changing to Emergency Mode”
Example 10. 14. Changing to Rescue Mode
To enter rescue mode in the current session, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service72
10. 3. 6. Changing to Emergency Mode
Emergency mode provides the most minimal environment possible and allows you to repair your system even in situations when the system is unable to enter rescue mode. Ở chế độ khẩn cấp, hệ thống chỉ gắn hệ thống tệp gốc để đọc, không cố gắn bất kỳ hệ thống tệp cục bộ nào khác, không kích hoạt giao diện mạng và chỉ bắt đầu một vài dịch vụ thiết yếu. In Red Hat Enterprise Linux 7, emergency mode requires the root password.
To change the current target and enter emergency mode, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service73
This command is similar to
~]# systemctl stop nfs-server.service514, but it also sends an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run this command with the
~]# systemctl stop nfs-server.service511 command line option
~]# systemctl stop nfs-server.service74
For information on how to enter rescue mode, see Section 10. 3. 5, “Changing to Rescue Mode”
Ví dụ 10. 15. Changing to Emergency Mode
To enter emergency mode without sending a message to all users that are currently logged into the system, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service75
10. 4. Shutting Down, Suspending, and Hibernating the System
In Red Hat Enterprise Linux 7, the
~]# systemctl stop nfs-server.service29 utility replaces a number of power management commands used in previous versions of the Red Hat Enterprise Linux system. The commands listed in Table 10. 8, “So sánh các lệnh quản lý năng lượng với systemctl” vẫn có sẵn trong hệ thống vì lý do tương thích, nhưng bạn nên sử dụng
~]# systemctl stop nfs-server.service29 khi có thể
Bảng 10. 8. Comparison of Power Management Commands with systemctl
Old CommandNew CommandDescription
~]# systemctl stop nfs-server.service519
~]# systemctl stop nfs-server.service520
Halts the system
~]# systemctl stop nfs-server.service521
~]# systemctl stop nfs-server.service522
Powers off the system
~]# systemctl stop nfs-server.service523
~]# systemctl stop nfs-server.service524
Khởi động lại hệ thống
~]# systemctl stop nfs-server.service525
~]# systemctl stop nfs-server.service526
Suspends the system
~]# systemctl stop nfs-server.service527
~]# systemctl stop nfs-server.service528
Hibernates the system
~]# systemctl stop nfs-server.service529
~]# systemctl stop nfs-server.service530
Hibernates and suspends the system
10. 4. 1. Shutting Down the System
The
~]# systemctl stop nfs-server.service29 utility provides commands for shutting down the system, however the traditional
~]# systemctl stop nfs-server.service532 command is also supported. Although the
~]# systemctl stop nfs-server.service532 command will call the
~]# systemctl stop nfs-server.service29 utility to perform the shutdown, it has an advantage in that it also supports a time argument. This is particularly useful for scheduled maintenance and to allow more time for users to react to the warning that a system shutdown has been scheduled. The option to cancel the shutdown can also be an advantageUsing systemctl Commands
To shut down the system and power off the machine, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service76
Để tắt và tạm dừng hệ thống mà không cần tắt nguồn máy, hãy chạy lệnh sau là
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service77
By default, running either of these commands causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run the selected command with the
~]# systemctl stop nfs-server.service511 command line option, for example
~]# systemctl stop nfs-server.service78Using the shutdown Command
To shut down the system and power off the machine at a certain time, use a command in the following format as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service79
Where hh. mm is the time in 24 hour clock format. The
~]# systemctl stop nfs-server.service539 file is created 5 minutes before system shutdown to prevent new logins. When a time argument is used, an optional message, the wall message , can be appended to the command.
To shut down and halt the system after a delay, without powering off the machine, use a command in the following format as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service80
Ở đâu +m là thời gian trễ tính bằng phút. The
~]# systemctl stop nfs-server.service541 keyword is an alias for
~]# systemctl stop nfs-server.service542.
A pending shutdown can be canceled by the
~]# systemctl stop nfs-server.service402 user as follows
~]# systemctl stop nfs-server.service81
See the
~]# systemctl stop nfs-server.service544 manual page for further command options
10. 4. 2. Restarting the System
To restart the system, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service82
By default, this command causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run this command with the
~]# systemctl stop nfs-server.service511 command line option
~]# systemctl stop nfs-server.service83
10. 4. 3. Suspending the System
To suspend the system, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service84
This command saves the system state in RAM and with the exception of the RAM module, powers off most of the devices in the machine. When you turn the machine back on, the system then restores its state from RAM without having to boot again. Because the system state is saved in RAM and not on the hard disk, restoring the system from suspend mode is significantly faster than restoring it from hibernation, but as a consequence, a suspended system state is also vulnerable to power outages
For information on how to hibernate the system, see Section 10. 4. 4, “Hibernating the System”
10. 4. 4. Hibernating the System
To hibernate the system, type the following at a shell prompt as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service85
This command saves the system state on the hard disk drive and powers off the machine. When you turn the machine back on, the system then restores its state from the saved data without having to boot again. Because the system state is saved on the hard disk and not in RAM, the machine does not have to maintain electrical power to the RAM module, but as a consequence, restoring the system from hibernation is significantly slower than restoring it from suspend mode
To hibernate and suspend the system, run the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service86
For information on how to suspend the system, see Section 10. 4. 3, “Suspending the System”
10. 5. Controlling systemd on a Remote Machine
In addition to controlling the systemd system and service manager locally, the
~]# systemctl stop nfs-server.service29 utility also allows you to interact with systemd running on a remote machine over the SSH protocol. Provided that the
~]# systemctl stop nfs-server.service551 service on the remote machine is running, you can connect to this machine by running the
~]# systemctl stop nfs-server.service29 command with the
~]# systemctl stop nfs-server.service553 or
~]# systemctl stop nfs-server.service554 command line option
~]# systemctl stop nfs-server.service87
Replace user_name with the name of the remote user, host_name with the machine’s host name, and
~]# systemctl stop nfs-server.service555 with any of the
~]# systemctl stop nfs-server.service29 commands described above. Lưu ý rằng máy từ xa phải được định cấu hình để cho phép người dùng được chọn truy cập từ xa qua giao thức SSH. For more information on how to configure an SSH server, see Chapter 12, OpenSSH.
Example 10. 16. Remote Management
To log in to a remote machine named
~]# systemctl stop nfs-server.service557 as the
~]# systemctl stop nfs-server.service402 user and determine the current status of the
~]# systemctl stop nfs-server.service415 unit, type the following at a shell prompt
~]# systemctl stop nfs-server.service88
10. 6. Creating and Modifying systemd Unit Files
A unit file contains configuration directives that describe the unit and define its behavior. Several
~]# systemctl stop nfs-server.service29 commands work with unit files in the background. To make finer adjustments, system administrator must edit or create unit files manually. Table 10. 2, “Systemd Unit Files Locations” lists three main directories where unit files are stored on the system, the
~]# systemctl stop nfs-server.service22 directory is reserved for unit files created or customized by the system administrator
Unit file names take the following form
~]# systemctl stop nfs-server.service89
Here, unit_name stands for the name of the unit and type_extension identifies the unit type, see Table 10. 1, “Available systemd Unit Types” for a complete list of unit types. For example, there usually is
~]# systemctl stop nfs-server.service562 as well as
~]# systemctl stop nfs-server.service563 unit present on your system.
Unit files can be supplemented with a directory for additional configuration files. For example, to add custom configuration options to
~]# systemctl stop nfs-server.service562, create the
~]# systemctl stop nfs-server.service565 file and insert additional directives there. For more information on configuration directories, see Section 10. 6. 4, “Modifying Existing Unit Files”
Also, the
~]# systemctl stop nfs-server.service566 and
~]# systemctl stop nfs-server.service567 directories can be created. These directories contain symbolic links to unit files that are dependencies of the
~]# systemctl stop nfs-server.service551 service. The symbolic links are automatically created either during installation according to [Install] unit file options [see Table 10. 11, “Important [Install] Section Options”] or at runtime based on [Unit] options [see Table 10. 9, “Important [Unit] Section Options”]. It is also possible to create these directories and symbolic links manually
Many unit file options can be set using the so called unit specifiers – wildcard strings that are dynamically replaced with unit parameters when the unit file is loaded. This enables creation of generic unit files that serve as templates for generating instantiated units. See Section 10. 6. 5, “Working with Instantiated Units” for details.
10. 6. 1. Understanding the Unit File Structure
Unit files typically consist of three sections
- [Unit] — contains generic options that are not dependent on the type of the unit. These options provide unit description, specify the unit’s behavior, and set dependencies to other units. For a list of most frequently used [Unit] options, see Table 10. 9, “Important [Unit] Section Options”
- [ unit type ] — if a unit has type-specific directives, these are grouped under a section named after the unit type. For example, service unit files contain the [Service] section, see Table 10. 10, “Important [Service] Section Options” for most frequently used [Service] options.
- [Install] — contains information about unit installation used by
~]# systemctl stop nfs-server.service
23 and~]# systemctl stop nfs-server.service
570 commands, see Table 10. 11, “Important [Install] Section Options” for a list of [Install] options
Table 10. 9. Important [Unit] Section Options
Option[a] section, see the
~]# systemctl stop nfs-server.service571 manual page. ]Description
~]# systemctl stop nfs-server.service572
A meaningful description of the unit. This text is displayed for example in the output of the
~]# systemctl stop nfs-server.service573 command
~]# systemctl stop nfs-server.service574
Provides a list of URIs referencing documentation for the unit
~]# systemctl stop nfs-server.service575[b]
Defines the order in which units are started. The unit starts only after the units specified in
~]# systemctl stop nfs-server.service575 are active. Unlike
~]# systemctl stop nfs-server.service577,
~]# systemctl stop nfs-server.service575 does not explicitly activate the specified units. The
~]# systemctl stop nfs-server.service579 option has the opposite functionality to
~]# systemctl stop nfs-server.service575
~]# systemctl stop nfs-server.service577
Configures dependencies on other units. The units listed in
~]# systemctl stop nfs-server.service577 are activated together with the unit. If any of the required units fail to start, the unit is not activated
~]# systemctl stop nfs-server.service583
Configures weaker dependencies than
~]# systemctl stop nfs-server.service577. If any of the listed units does not start successfully, it has no impact on the unit activation. This is the recommended way to establish custom unit dependencies
~]# systemctl stop nfs-server.service585
Configures negative dependencies, an opposite to
~]# systemctl stop nfs-server.service577
[a] For a complete list of options configurable in the [Unit
[b] In most cases, it is sufficient to set only the ordering dependencies with
~]# systemctl stop nfs-server.service575 and
~]# systemctl stop nfs-server.service579 unit file options. If you also set a requirement dependency with
~]# systemctl stop nfs-server.service583 [recommended] or
~]# systemctl stop nfs-server.service577, the ordering dependency still needs to be specified. That is because ordering and requirement dependencies work independently from each other
Table 10. 10. Important [Service] Section Options
Option[a] section, see the
~]# systemctl stop nfs-server.service591 manual page. ]Description
~]# systemctl stop nfs-server.service592
Configures the unit process startup type that affects the functionality of
~]# systemctl stop nfs-server.service593 and related options. Một trong
*
~]# systemctl stop nfs-server.service594 – The default value. The process started with
~]# systemctl stop nfs-server.service593 is the main process of the service
*
~]# systemctl stop nfs-server.service596 – The process started with
~]# systemctl stop nfs-server.service593 spawns a child process that becomes the main process of the service. The parent process exits when the startup is complete
*
~]# systemctl stop nfs-server.service598 – This type is similar to
~]# systemctl stop nfs-server.service594, but the process exits before starting consequent units
*
~]# systemctl stop nfs-server.service700 – This type is similar to
~]# systemctl stop nfs-server.service594, but consequent units are started only after the main process gains a D-Bus name
*
~]# systemctl stop nfs-server.service702 – This type is similar to
~]# systemctl stop nfs-server.service594, but consequent units are started only after a notification message is sent via the sd_notify[] function
*
~]# systemctl stop nfs-server.service704 – similar to
~]# systemctl stop nfs-server.service594, the actual execution of the service binary is delayed until all jobs are finished, which avoids mixing the status output with shell output of services
~]# systemctl stop nfs-server.service593
Specifies commands or scripts to be executed when the unit is started.
~]# systemctl stop nfs-server.service707 and
~]# systemctl stop nfs-server.service708 specify custom commands to be executed before and after
~]# systemctl stop nfs-server.service593.
~]# systemctl stop nfs-server.service710 enables specifying multiple custom commands that are then executed sequentially
~]# systemctl stop nfs-server.service711
Specifies commands or scripts to be executed when the unit is stopped
~]# systemctl stop nfs-server.service712
Specifies commands or scripts to be executed when the unit is reloaded
~]# systemctl stop nfs-server.service713
With this option enabled, the service is restarted after its process exits, with the exception of a clean stop by the
~]# systemctl stop nfs-server.service29 command
~]# systemctl stop nfs-server.service715
If set to True, the service is considered active even when all its processes exited. Default value is False. This option is especially useful if
~]# systemctl stop nfs-server.service710 is configured
[a] For a complete list of options configurable in the [Service
Table 10. 11. Important [Install] Section Options
Option[a] section, see the
~]# systemctl stop nfs-server.service571 manual page. ]Description
~]# systemctl stop nfs-server.service718
Provides a space-separated list of additional names for the unit. Most
~]# systemctl stop nfs-server.service29 commands, excluding
~]# systemctl stop nfs-server.service23, can use aliases instead of the actual unit name
~]# systemctl stop nfs-server.service721
A list of units that depend on the unit. When this unit is enabled, the units listed in
~]# systemctl stop nfs-server.service721 gain a
~]# systemctl stop nfs-server.service723 dependency on the unit
~]# systemctl stop nfs-server.service724
A list of units that weakly depend on the unit. Khi thiết bị này được bật, các thiết bị được liệt kê trong
~]# systemctl stop nfs-server.service724 sẽ nhận được sự phụ thuộc của
~]# systemctl stop nfs-server.service726 vào thiết bị
~]# systemctl stop nfs-server.service727
Specifies a list of units to be installed or uninstalled along with the unit
~]# systemctl stop nfs-server.service728
Limited to instantiated units, this option specifies the default instance for which the unit is enabled. See Section 10. 6. 5, “Working with Instantiated Units”
[a] For a complete list of options configurable in the [Install
A whole range of options that can be used to fine tune the unit configuration, Example 10. 17, “postfix. service Unit File” shows an example of a service unit installed on the system. Moreover, unit file options can be defined in a way that enables dynamic creation of units as described in Section 10. 6. 5, “Working with Instantiated Units”
Example 10. 17. postfix. service Unit File
What follows is the content of the
~]# systemctl stop nfs-server.service729 unit file as currently provided by the postfix package.
~]# systemctl stop nfs-server.service70
The [Unit] section describes the service, specifies the ordering dependencies, as well as conflicting units. In [Service], a sequence of custom scripts is specified to be executed during unit activation, on stop, and on reload.
~]# systemctl stop nfs-server.service730 points to the location where environment variables for the service are defined,
~]# systemctl stop nfs-server.service731 specifies a stable PID for the main process of the service. Finally, the [Install] section lists units that depend on the service
10. 6. 2. Creating Custom Unit Files
There are several use cases for creating unit files from scratch. you could run a custom daemon, create a second instance of some existing service [as in Example 10. 19, “Creating a second instance of the sshd service”], or import a SysV init script [more in Section 10. 6. 3, “Converting SysV Init Scripts to Unit Files”]. On the other hand, if you intend just to modify or extend the behavior of an existing unit, use the instructions from Section 10. 6. 4, “Modifying Existing Unit Files”. The following procedure describes the general process of creating a custom service
- Prepare the executable file with the custom service. This can be a custom-created script, or an executable delivered by a software provider. If required, prepare a PID file to hold a constant PID for the main process of the custom service. It is also possible to include environment files to store shell variables for the service. Make sure the source script is executable [by executing the
~]# systemctl stop nfs-server.service
732] and is not interactive Create a unit file in the
~]# systemctl stop nfs-server.service
22 directory and make sure it has correct file permissions. Execute as~]# systemctl stop nfs-server.service
402~]# systemctl stop nfs-server.service
71Replace name with a name of the service to be created. Note that file does not need to be executable.
Open the
~]# systemctl stop nfs-server.service
735 file created in the previous step, and add the service configuration options. There is a variety of options that can be used depending on the type of service you wish to create, see Section 10. 6. 1, “Understanding the Unit File Structure”. The following is an example unit configuration for a network-related service~]# systemctl stop nfs-server.service
72Where
- service_description is an informative description that is displayed in journal log files and in the output of the
~]# systemctl stop nfs-server.service
573 command. - the
~]# systemctl stop nfs-server.service
575 setting ensures that the service is started only after the network is running. Add a space-separated list of other relevant services or targets - path_to_executable stands for the path to the actual service executable.
~]# systemctl stop nfs-server.service
738 được sử dụng cho các daemon thực hiện lệnh gọi hệ thống fork. The main process of the service is created with the PID specified in path_to_pidfile . Find other startup types in Table 10. 10, “Important [Service] Section Options”.~]# systemctl stop nfs-server.service
724 states the target or targets that the service should be started under. Think of these targets as of a replacement of the older concept of runlevels, see Section 10. 3, “Working with systemd Targets” for details
- service_description is an informative description that is displayed in journal log files and in the output of the
Notify systemd that a new
~]# systemctl stop nfs-server.service
735 file exists by executing the following command as~]# systemctl stop nfs-server.service
402~]# systemctl stop nfs-server.service
73Warning
Always run the
~]# systemctl stop nfs-server.service
742 command after creating new unit files or modifying existing unit files. Otherwise, the~]# systemctl stop nfs-server.service
743 or~]# systemctl stop nfs-server.service
23 commands could fail due to a mismatch between states of systemd and actual service unit files on diskThe name . service unit can now be managed as any other system service with commands described in Section 10. 2, “Managing System Services”.
Example 10. 18. Creating the emacs. service File
When using the Emacs text editor, it is often faster and more convenient to have it running in the background instead of starting a new instance of the program whenever editing a file. The following steps show how to create a unit file for Emacs, so that it can be handled like a service.
Create a unit file in the
~]# systemctl stop nfs-server.service
22 directory and make sure it has the correct file permissions. Execute as~]# systemctl stop nfs-server.service
402~]# systemctl stop nfs-server.service
74Add the following content to the file
~]# systemctl stop nfs-server.service
75With the above configuration, the
~]# systemctl stop nfs-server.service
747 executable is started in daemon mode on service start. The SSH_AUTH_SOCK environment variable is set using the "%t" unit specifier that stands for the runtime directory. The service also restarts the emacs process if it exits unexpectedlyExecute the following commands to reload the configuration and start the custom service
~]# systemctl stop nfs-server.service
76
As the editor is now registered as a systemd service, you can use all standard
~]# systemctl stop nfs-server.service29 commands. For example, run
~]# systemctl stop nfs-server.service749 to display the editor’s status or
~]# systemctl stop nfs-server.service750 to make the editor start automatically on system boot
Example 10. 19. Creating a second instance of the sshd service
System Administrators often need to configure and run multiple instances of a service. This is done by creating copies of the original service configuration files and modifying certain parameters to avoid conflicts with the primary instance of the service. The following procedure shows how to create a second instance of the
~]# systemctl stop nfs-server.service551 service
Create a copy of the
~]# systemctl stop nfs-server.service
752 file that will be used by the second daemon~]# systemctl stop nfs-server.service
77Edit the
~]# systemctl stop nfs-server.service
753 file created in the previous step to assign a different port number and PID file to the second daemon~]# systemctl stop nfs-server.service
78See the
~]# systemctl stop nfs-server.service
752[5] manual page for more information on~]# systemctl stop nfs-server.service
755 and~]# systemctl stop nfs-server.service
756 options. Make sure the port you choose is not in use by any other service. The PID file does not have to exist before running the service, it is generated automatically on service startTạo một bản sao của tệp đơn vị systemd cho dịch vụ
~]# systemctl stop nfs-server.service
551~]# systemctl stop nfs-server.service
79Alter the
~]# systemctl stop nfs-server.service
758 created in the previous step as followsModify the
~]# systemctl stop nfs-server.service
572 option~]# systemctl stop nfs-server.service
80Add sshd. service to services specified in the
~]# systemctl stop nfs-server.service
575 option, so that the second instance starts only after the first one has already started~]# systemctl stop nfs-server.service
81- The first instance of sshd includes key generation, therefore remove the ExecStartPre=/usr/sbin/sshd-keygen line.
Add the
~]# systemctl stop nfs-server.service
761 parameter to the~]# systemctl stop nfs-server.service
551 command, so that the alternative configuration file is used~]# systemctl stop nfs-server.service
82After the above modifications, the sshd-second. service should look as follows
~]# systemctl stop nfs-server.service
83
If using SELinux, add the port for the second instance of sshd to SSH ports, otherwise the second instance of sshd will be rejected to bind to the port
~]# systemctl stop nfs-server.service
84Enable sshd-second. service, so that it starts automatically upon boot
~]# systemctl stop nfs-server.service
85Verify if the sshd-second. service is running by using the
~]# systemctl stop nfs-server.service
573 command. Also, verify if the port is enabled correctly by connecting to the service~]# systemctl stop nfs-server.service
86If the firewall is in use, make sure that it is configured appropriately in order to allow connections to the second instance of sshd
To learn how to properly choose a target for ordering and dependencies of your custom unit files, see the following articles
- How to write a service unit file which enforces that particular services have to be started
- How to decide what dependencies a systemd service unit definition should have
Additional information with some real-world examples of cases triggered by the ordering and dependencies in a unit file is available in the following article. Is there any useful information about writing unit files?
If you want to set limits for services started by
~]# systemctl stop nfs-server.service82, see the Red Hat Knowledgebase article How to set limits for services in RHEL 7 and systemd. These limits need to be set in the service’s unit file. Note that
~]# systemctl stop nfs-server.service82 ignores limits set in the
~]# systemctl stop nfs-server.service766 and
~]# systemctl stop nfs-server.service767 configuration files. The limits defined in these files are set by PAM when starting a login session, but daemons started by
~]# systemctl stop nfs-server.service82 do not use PAM login sessions
10. 6. 3. Converting SysV Init Scripts to Unit Files
Before taking time to convert a SysV init script to a unit file, make sure that the conversion was not already done elsewhere. All core services installed on Red Hat Enterprise Linux 7 come with default unit files, and the same applies for many third-party software packages
Converting an init script to a unit file requires analyzing the script and extracting the necessary information from it. Based on this data you can create a unit file as described in Section 10. 6. 2, “Creating Custom Unit Files”. As init scripts can vary greatly depending on the type of the service, you might need to employ more configuration options for translation than outlined in this chapter. Note that some levels of customization that were available with init scripts are no longer supported by systemd units, see Section 10. 1. 2, “Compatibility Changes”
The majority of information needed for conversion is provided in the script’s header. The following example shows the opening section of the init script used to start the
~]# systemctl stop nfs-server.service450 service on Red Hat Enterprise Linux 6
~]# systemctl stop nfs-server.service87
In the above example, only lines starting with # chkconfig and # description are mandatory, so you might not find the rest in different init files. The text enclosed between the # BEGIN INIT INFO and # END INIT INFO lines is called Linux Standard Base [LSB] header . If specified, LSB headers contain directives defining the service description, dependencies, and default runlevels. What follows is an overview of analytic tasks aiming to collect the data needed for a new unit file. The postfix init script is used as an example, see the resulting postfix unit file in Example 10. 17, “postfix. service Unit File”.
Finding the Service DescriptionFind descriptive information about the script on the line starting with #description . Use this description together with the service name in the
~]# systemctl stop nfs-server.service572 option in the [Unit] section of the unit file. The LSB header might contain similar data on the #Short-Description and #Description lines. Finding Service Dependencies
The LSB header might contain several directives that form dependencies between services. Most of them are translatable to systemd unit options, see Table 10. 12, “Dependency Options from the LSB Header”
Table 10. 12. Dependency Options from the LSB Header
LSB OptionDescriptionUnit File Equivalent
~]# systemctl stop nfs-server.service771
Specifies the boot facility name of the service, that can be referenced in other init scripts [with the "$" prefix]. This is no longer needed as unit files refer to other units by their file names
–
~]# systemctl stop nfs-server.service772
Contains boot facility names of required services. This is translated as an ordering dependency, boot facility names are replaced with unit file names of corresponding services or targets they belong to. For example, in case of
~]# systemctl stop nfs-server.service450, the Required-Start dependency on $network was translated to the After dependency on network. target
~]# systemctl stop nfs-server.service575,
~]# systemctl stop nfs-server.service579
~]# systemctl stop nfs-server.service776
Constitutes weaker dependencies than Required-Start. Failed Should-Start dependencies do not affect the service startup
~]# systemctl stop nfs-server.service575,
~]# systemctl stop nfs-server.service579
~]# systemctl stop nfs-server.service779,
~]# systemctl stop nfs-server.service780
Constitute negative dependencies
~]# systemctl stop nfs-server.service585Finding Default Targets of the Service
The line starting with #chkconfig contains three numerical values. Điều quan trọng nhất là số đầu tiên đại diện cho mức chạy mặc định trong đó dịch vụ được bắt đầu. Use Table 10. 6, “Comparison of SysV Runlevels with systemd Targets” to map these runlevels to equivalent systemd targets. Then list these targets in the
~]# systemctl stop nfs-server.service724 option in the [Install] section of the unit file. For example,
~]# systemctl stop nfs-server.service450 was previously started in runlevels 2, 3, 4, and 5, which translates to multi-user. target and graphical. target on Red Hat Enterprise Linux 7. Note that the graphical. target depends on multiuser. target, therefore it is not necessary to specify both, as in Example 10. 17, “postfix. service Unit File”. You might find information on default and forbidden runlevels also at #Default-Start and #Default-Stop lines in the LSB header.
The other two values specified on the #chkconfig line represent startup and shutdown priorities of the init script. These values are interpreted by systemd if it loads the init script, but there is no unit file equivalent
Finding Files Used by the ServiceInit scripts require loading a function library from a dedicated directory and allow importing configuration, environment, and PID files. Environment variables are specified on the line starting with #config in the init script header, which translates to the
~]# systemctl stop nfs-server.service730 unit file option. The PID file specified on the #pidfile init script line is imported to the unit file with the
~]# systemctl stop nfs-server.service731 option.
The key information that is not included in the init script header is the path to the service executable, and potentially some other files required by the service. In previous versions of Red Hat Enterprise Linux, init scripts used a Bash case statement to define the behavior of the service on default actions, such as start , stop , or restart , as well as custom-defined actions. The following excerpt from the
~]# systemctl stop nfs-server.service450 init script shows the block of code to be executed at service start.
~]# systemctl stop nfs-server.service88
The extensibility of the init script allowed specifying two custom functions,
~]# systemctl stop nfs-server.service787 and
~]# systemctl stop nfs-server.service788, that are called from the
~]# systemctl stop nfs-server.service789 function block. On closer look, several external files and directories are mentioned in the above code. the main service executable
~]# systemctl stop nfs-server.service790, the
~]# systemctl stop nfs-server.service791 and
~]# systemctl stop nfs-server.service792 configuration directories, as well as the
~]# systemctl stop nfs-server.service793 directory
Systemd supports only the predefined actions, but enables executing custom executables with
~]# systemctl stop nfs-server.service593,
~]# systemctl stop nfs-server.service707,
~]# systemctl stop nfs-server.service708,
~]# systemctl stop nfs-server.service711, and
~]# systemctl stop nfs-server.service712 options. In case of
~]# systemctl stop nfs-server.service450 on Red Hat Enterprise Linux 7, the
~]# systemctl stop nfs-server.service790 together with supporting scripts are executed on service start. Consult the
~]# systemctl stop nfs-server.service450 unit file at Example 10. 17, “postfix. dịch vụ Tập tin đơn vị”
Chuyển đổi các tập lệnh init phức tạp đòi hỏi phải hiểu mục đích của mọi câu lệnh trong tập lệnh. Một số câu lệnh dành riêng cho phiên bản hệ điều hành, do đó bạn không cần phải dịch chúng. Mặt khác, một số điều chỉnh có thể cần thiết trong môi trường mới, cả trong tệp đơn vị cũng như trong các tệp hỗ trợ và thực thi dịch vụ
10. 6. 4. Sửa đổi tập tin đơn vị hiện có
Các dịch vụ được cài đặt trên hệ thống đi kèm với các tệp đơn vị mặc định được lưu trữ trong thư mục
~]# systemctl stop nfs-server.service20. Quản trị viên hệ thống không nên trực tiếp sửa đổi các tệp này, do đó mọi tùy chỉnh phải được giới hạn trong các tệp cấu hình trong thư mục
~]# systemctl stop nfs-server.service22. Tùy thuộc vào mức độ thay đổi cần thiết, hãy chọn một trong các phương pháp sau
- Tạo một thư mục cho các tệp cấu hình bổ sung tại
~]# systemctl stop nfs-server.service
804. Phương pháp này được khuyến nghị cho hầu hết các trường hợp sử dụng. Nó cho phép mở rộng cấu hình mặc định với chức năng bổ sung, trong khi vẫn tham chiếu đến tệp đơn vị gốc. Do đó, các thay đổi đối với đơn vị mặc định được giới thiệu khi nâng cấp gói được áp dụng tự động. Xem phần có tên “Mở rộng Cấu hình Đơn vị Mặc định” để biết thêm thông tin - Create a copy of the original unit file
~]# systemctl stop nfs-server.service
20 in~]# systemctl stop nfs-server.service
22 and make changes there. Bản sao sẽ ghi đè tệp gốc, do đó, những thay đổi được đưa ra với bản cập nhật gói không được áp dụng. Phương pháp này hữu ích để thực hiện các thay đổi đơn vị quan trọng sẽ tồn tại bất kể các bản cập nhật gói. Xem phần có tên “Ghi đè Cấu hình Đơn vị Mặc định” để biết chi tiết
Để quay lại cấu hình mặc định của thiết bị, chỉ cần xóa các tệp cấu hình được tạo tùy chỉnh trong
~]# systemctl stop nfs-server.service22. Để áp dụng các thay đổi cho các tệp đơn vị mà không cần khởi động lại hệ thống, hãy thực thi
~]# systemctl stop nfs-server.service89
Tùy chọn
~]# systemctl stop nfs-server.service808 tải lại tất cả các tệp đơn vị và tạo lại toàn bộ cây phụ thuộc, cần thiết để áp dụng ngay bất kỳ thay đổi nào đối với tệp đơn vị. Thay vào đó, bạn có thể đạt được kết quả tương tự bằng lệnh sau
~]# systemctl stop nfs-server.service010
Ngoài ra, nếu tệp đơn vị đã sửa đổi thuộc về một dịch vụ đang chạy, dịch vụ này phải được khởi động lại để chấp nhận cài đặt mới
~]# systemctl stop nfs-server.service40
Quan trọng
Để sửa đổi các thuộc tính, chẳng hạn như phần phụ thuộc hoặc thời gian chờ, của một dịch vụ được xử lý bởi bản initscript SysV, không sửa đổi chính bản initscript đó. Thay vào đó, hãy tạo tệp cấu hình thả xuống
~]# systemctl stop nfs-server.service82 cho dịch vụ như được mô tả trong phần có tên “Mở rộng cấu hình đơn vị mặc định” và phần có tên “Ghi đè cấu hình đơn vị mặc định”. Sau đó, quản lý dịch vụ này giống như dịch vụ
~]# systemctl stop nfs-server.service82 bình thường
Ví dụ: để mở rộng cấu hình của dịch vụ
~]# systemctl stop nfs-server.service811, không sửa đổi tệp initscript
~]# systemctl stop nfs-server.service812. Thay vào đó, hãy tạo thư mục mới
~]# systemctl stop nfs-server.service813 và tệp thả xuống
~]# systemctl stop nfs-server.service82
~]# systemctl stop nfs-server.service815. Sau đó, đặt các giá trị đã sửa đổi vào tệp thả vào. Ghi chú.
~]# systemctl stop nfs-server.service82 biết dịch vụ
~]# systemctl stop nfs-server.service811 là
~]# systemctl stop nfs-server.service818, đó là lý do tại sao thư mục được tạo phải được gọi là
~]# systemctl stop nfs-server.service819Mở rộng cấu hình đơn vị mặc định
Để mở rộng tệp đơn vị mặc định với các tùy chọn cấu hình bổ sung, trước tiên hãy tạo một thư mục cấu hình trong
~]# systemctl stop nfs-server.service22. If extending a service unit, execute the following command as
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service012
Thay thế tên bằng tên của dịch vụ bạn muốn gia hạn. Cú pháp trên áp dụng cho tất cả các loại đơn vị.
Tạo tệp cấu hình trong thư mục đã tạo ở bước trước. Lưu ý rằng tên tệp phải kết thúc bằng . conf hậu tố. Loại hình.
~]# systemctl stop nfs-server.service013
Thay thế config_name bằng tên của tệp cấu hình. Tệp này tuân thủ cấu trúc tệp đơn vị bình thường, do đó, tất cả các lệnh phải được chỉ định trong các phần thích hợp, hãy xem Phần 10. 6. 1, “Tìm hiểu cấu trúc tệp đơn vị”.
Ví dụ: để thêm phụ thuộc tùy chỉnh, hãy tạo tệp cấu hình với nội dung sau
~]# systemctl stop nfs-server.service014
Ở đâu phần phụ thuộc mới là viết tắt của đơn vị được đánh dấu là phần phụ thuộc. Một ví dụ khác là tệp cấu hình khởi động lại dịch vụ sau khi quá trình chính của nó đã thoát, với độ trễ là 30 giây.
~]# systemctl stop nfs-server.service015
Nên tạo các tệp cấu hình nhỏ chỉ tập trung vào một tác vụ. Các tệp như vậy có thể dễ dàng di chuyển hoặc liên kết với các thư mục cấu hình của các dịch vụ khác
Để áp dụng các thay đổi được thực hiện cho đơn vị, hãy thực hiện như
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service016
Ví dụ 10. 20. Mở rộng httpd. cấu hình dịch vụ
Để sửa đổi httpd. đơn vị dịch vụ để tập lệnh shell tùy chỉnh được thực thi tự động khi khởi động dịch vụ Apache, hãy thực hiện các bước sau. Đầu tiên, tạo một thư mục và tệp cấu hình tùy chỉnh
~]# systemctl stop nfs-server.service017
Với điều kiện là tập lệnh bạn muốn bắt đầu tự động với Apache được đặt tại
~]# systemctl stop nfs-server.service823, hãy chèn văn bản sau vào tệp
~]# systemctl stop nfs-server.service824
~]# systemctl stop nfs-server.service018
Để áp dụng các thay đổi đơn vị, hãy thực hiện
~]# systemctl stop nfs-server.service019
Note
Các tệp cấu hình từ các thư mục cấu hình trong
~]# systemctl stop nfs-server.service22 được ưu tiên hơn các tệp đơn vị trong
~]# systemctl stop nfs-server.service20. Do đó, nếu các tệp cấu hình chứa một tùy chọn chỉ có thể được chỉ định một lần, chẳng hạn như
~]# systemctl stop nfs-server.service572 hoặc
~]# systemctl stop nfs-server.service593, thì giá trị mặc định của tùy chọn này sẽ bị ghi đè. Lưu ý rằng trong đầu ra của lệnh
~]# systemctl stop nfs-server.service829, được mô tả trong phần có tên "Đơn vị được ghi đè theo dõi", các đơn vị đó luôn được đánh dấu là [ĐÃ MỞ RỘNG], mặc dù về tổng thể, một số tùy chọn nhất định thực sự bị ghi đèOverriding the Default Unit Configuration
Để thực hiện các thay đổi sẽ tồn tại sau khi cập nhật gói cung cấp tệp đơn vị, trước tiên hãy sao chép tệp vào thư mục
~]# systemctl stop nfs-server.service22. Để làm như vậy, hãy thực hiện lệnh sau như
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service020
Ở đâu tên là tên của đơn vị dịch vụ mà bạn muốn sửa đổi. Cú pháp trên áp dụng cho tất cả các loại đơn vị.
Mở tệp đã sao chép bằng trình soạn thảo văn bản và thực hiện các thay đổi mong muốn. Để áp dụng các thay đổi đơn vị, hãy thực hiện như
~]# systemctl stop nfs-server.service402
~]# systemctl stop nfs-server.service016
Ví dụ 10. 21. Thay đổi giới hạn thời gian chờ
Bạn có thể chỉ định giá trị thời gian chờ cho mỗi dịch vụ để ngăn dịch vụ bị trục trặc đóng băng hệ thống. Mặt khác, thời gian chờ được đặt theo mặc định là 90 giây đối với các dịch vụ thông thường và 300 giây đối với các dịch vụ tương thích với SysV
Ví dụ: để mở rộng giới hạn thời gian chờ cho dịch vụ
~]# systemctl stop nfs-server.service89
Sao chép tệp đơn vị
~]# systemctl stop nfs-server.service
89 vào thư mục~]# systemctl stop nfs-server.service
22~]# systemctl stop nfs-server.service
022Mở tệp
~]# systemctl stop nfs-server.service
836 và chỉ định giá trị~]# systemctl stop nfs-server.service
837 trong phần~]# systemctl stop nfs-server.service
838~]# systemctl stop nfs-server.service
023Tải lại trình nền
~]# systemctl stop nfs-server.service
82~]# systemctl stop nfs-server.service
89Tùy chọn. Xác minh giá trị thời gian chờ mới.
~]# systemctl stop nfs-server.service
025
Note
Để thay đổi giới hạn thời gian chờ trên toàn cầu, hãy nhập
~]# systemctl stop nfs-server.service25 vào tệp
~]# systemctl stop nfs-server.service24. Xem Phần 10. 1, “Giới thiệu về systemd”Giám sát các đơn vị bị ghi đè
To display an overview of overridden or modified unit files, use the following command
~]# systemctl stop nfs-server.service026
Ví dụ: đầu ra của lệnh trên có thể trông như sau
~]# systemctl stop nfs-server.service027
Bảng 10. 13, “Các loại khác biệt systemd-delta” liệt kê các loại ghi đè có thể xuất hiện trong đầu ra của
~]# systemctl stop nfs-server.service829. Lưu ý rằng nếu một tệp bị ghi đè, theo mặc định,
~]# systemctl stop nfs-server.service829 sẽ hiển thị tóm tắt các thay đổi tương tự như đầu ra của lệnh
~]# systemctl stop nfs-server.service844
Bảng 10. 13. Các loại khác biệt systemd-delta
TypeDescription
[CHE MẶT]
Masked unit files, see Section 10. 2. 7, “Disabling a Service” for description of unit masking
[TƯƠNG ĐƯƠNG]
Các bản sao chưa sửa đổi ghi đè lên các tệp gốc nhưng không khác về nội dung, thường là các liên kết tượng trưng
[REDIRECTED]
Files that are redirected to another file
[OVERRIDEN]
Overridden and changed files
[EXTENDED]
Files that are extended with . conf files in the
~]# systemctl stop nfs-server.service804 directory
[UNCHANGED]
Unmodified files are displayed only when the
~]# systemctl stop nfs-server.service846 option is used
It is good practice to run
~]# systemctl stop nfs-server.service829 after system update to check if there are any updates to the default units that are currently overridden by custom configuration. It is also possible to limit the output only to a certain difference type. For example, to view just the overridden units, execute
~]# systemctl stop nfs-server.service028
10. 6. 5. Working with Instantiated Units
It is possible to instantiate multiple units from a single template configuration file at runtime. The "@" character is used to mark the template and to associate units with it. Instantiated units can be started from another unit file [using
~]# systemctl stop nfs-server.service577 or
~]# systemctl stop nfs-server.service583 options], or with the
~]# systemctl stop nfs-server.service743 command. Instantiated service units are named the following way
~]# systemctl stop nfs-server.service029
Where template_name stands for the name of the template configuration file. Replace instance_name with the name for the unit instance. Một số phiên bản có thể trỏ đến cùng một tệp mẫu với các tùy chọn cấu hình phổ biến cho tất cả các phiên bản của đơn vị. Template unit name has the form of.
~]# systemctl stop nfs-server.service00
For example, the following
~]# systemctl stop nfs-server.service583 setting in a unit file
~]# systemctl stop nfs-server.service01
first makes systemd search for given service units. Nếu không tìm thấy đơn vị nào như vậy, phần giữa "@" và hậu tố loại sẽ bị bỏ qua và systemd tìm kiếm tệp
~]# systemctl stop nfs-server.service852, đọc cấu hình từ tệp đó và khởi động dịch vụ
Wildcard characters, called unit specifiers , can be used in any unit configuration file. Bộ xác định đơn vị thay thế các tham số đơn vị nhất định và được giải thích trong thời gian chạy. Table 10. 14, “Important Unit Specifiers” lists unit specifiers that are particularly useful for template units.
Table 10. 14. Important Unit Specifiers
Unit SpecifierMeaningDescription
~]# systemctl stop nfs-server.service853
Full unit name
Stands for the full unit name including the type suffix.
~]# systemctl stop nfs-server.service854 có ý nghĩa tương tự nhưng cũng thay thế các ký tự bị cấm bằng mã ASCII
~]# systemctl stop nfs-server.service855
Prefix name
Stands for a unit name with type suffix removed. Đối với các đơn vị được khởi tạo %p là viết tắt của phần tên đơn vị trước ký tự "@"
~]# systemctl stop nfs-server.service856
Tên trường hợp
Is the part of the instantiated unit name between the "@" character and the type suffix.
~]# systemctl stop nfs-server.service857 has the same meaning but also replaces the forbidden characters for ASCII codes
~]# systemctl stop nfs-server.service858
Host name
Viết tắt của tên máy chủ của hệ thống đang chạy tại thời điểm cấu hình đơn vị được tải
~]# systemctl stop nfs-server.service859
thư mục thời gian chạy
Represents the runtime directory, which is either
~]# systemctl stop nfs-server.service860 for the
~]# systemctl stop nfs-server.service402 user, or the value of the XDG_RUNTIME_DIR variable for unprivileged users
For a complete list of unit specifiers, see the
~]# systemctl stop nfs-server.service571 manual page
Ví dụ: mẫu
~]# systemctl stop nfs-server.service852 chứa các lệnh sau
~]# systemctl stop nfs-server.service02
Khi getty@ttyA. service and getty@ttyB. service are instantiated form the above template,
~]# systemctl stop nfs-server.service572= is resolved as Getty on ttyA and Getty on ttyB .
10. 7. Additional Considerations While Managing Services
Trong quá trình hoạt động bình thường, systemd duy trì mối liên hệ giữa trừu tượng hóa đơn vị và các quy trình cơ bản đang hoạt động trên hệ thống
From.
~]# systemctl stop nfs-server.service865
~]# systemctl stop nfs-server.service03
The cgroup hierarchy is critical to systemd’s view of process and service health. Khi một tiến trình tự phân nhánh, nó sẽ kế thừa cgroup của tiến trình tạo. With this being the case, all processes associated with a given unit can be verified by reading the contents of the applicable cgroup. tập tin procs, chẳng hạn như
~]# systemctl stop nfs-server.service04
The output matches the CGroup information returned during a
~]# systemctl stop nfs-server.service866 operation.
~]# systemctl stop nfs-server.service05
To directly view these groupings of processes system-wide, the
~]# systemctl stop nfs-server.service867 utility can be used
~]# systemctl stop nfs-server.service06
In order for systemd to function properly, the service must be started or stopped through the systemd system to maintain the correct process to unit grouping. Bất kỳ thao tác nào thực hiện hành động bên ngoài đều dẫn đến cấu trúc cgroup cần thiết không được tạo. This happens because systemd is not aware of the special nature of the processes being started
Như một ví dụ về ràng buộc trên, việc dừng dịch vụ
~]# systemctl stop nfs-server.service89 và sau đó phát hành trực tiếp
~]# systemctl stop nfs-server.service869 dẫn đến kết quả sau
~]# systemctl stop nfs-server.service07
Note that the
~]# systemctl stop nfs-server.service89 process is now visible under the user-0. slice and a session-168. phạm vi. Dịch vụ này được coi là quy trình do người dùng bắt đầu, trái ngược với dịch vụ hệ thống, systemd đó sẽ giám sát và quản lý trực tiếp. Một số lỗi có thể xảy ra do sự sai lệch này bao gồm, nhưng không giới hạn ở
- Services are not properly shutdown during system shutdown or restart events
- Các tín hiệu không mong muốn được gửi trong quá trình đăng xuất của người dùng như SIGHUP và SIGTERM
- Các quy trình không thành công sẽ không tự động khởi động lại mặc dù có chỉ thị
~]# systemctl stop nfs-server.service
871
Note
Các sự kiện tắt ứng dụng không linh hoạt có thể dẫn đến một số lượng lớn các lỗi ứng dụng tiếp theo, chẳng hạn như lỗi phía máy khách, mất dữ liệu và hỏng trên đĩa
10. 8. Tài nguyên bổ sung
Để biết thêm thông tin về systemd và cách sử dụng nó trên Red Hat Enterprise Linux 7, hãy xem các tài nguyên được liệt kê bên dưới