用户工具

站点工具


jaysnote:systemd

这是本文档旧的修订版!


systemd

man systemd

systemd 是linux操作系统的系统和服务管理器,在boot启动后的第一个进程(PID=1),systemd扮演初始化系统,其启动和维护用户空间服务。

为了兼容SysV,如果systemd以初始化被调用并且进程id不是1,它将执行telinit

当做为系统实例启动,systemd从system.conf 配置文件开始解释,否则从user.conf,更多信息参考systemd-system.conf

systemd vs sysv init

  • Systemd

  • system V与systemd

  • 系统同时存在sysV init脚本使能和systemd service,那么到底是生效了?

  • systemd如何控制sysV init脚本?

  • 如下路径的unit 关系,哪些unit是使能的?

    参考 man systemctl->COMMANDS->Unit File Commands-> enable NAME...

    /lib/systemd/system 保存了所有unit file,其中部分.service 文件包含[install] 部分,当调用systemctl enable watchdog.service 会在 /etc/systemd/systemd下面创建软连接。开机通过查找该路径下面的软连接启动对应服务。

    $ cat watchdog.service 
    [Install]
    WantedBy=multi-user.target
    $ tree /etc/systemd/system
    /etc/systemd/system
    ├── multi-user.target.wants
    │   ├── cron.service -> /lib/systemd/system/cron.service
    │   ├── redis-server.service -> /lib/systemd/system/redis-server.service
    │   ├── remote-fs.target -> /lib/systemd/system/remote-fs.target
    │   ├── rsync.service -> /lib/systemd/system/rsync.service
    │   ├── rsyslog.service -> /lib/systemd/system/rsyslog.service
    │   ├── ssh.service -> /lib/systemd/system/ssh.service
    │   ├── sudo.service -> /lib/systemd/system/sudo.service
    │   ├── systemd-networkd.service -> /lib/systemd/system/systemd-networkd.service
    │   ├── systemd-resolved.service -> /lib/systemd/system/systemd-resolved.service
    │   ├── watchdog.service -> /lib/systemd/system/watchdog.service
    │   └── wpa_supplicant.service -> /lib/systemd/system/wpa_supplicant.service

    可以通过systemctl list-unit-files |grep enable查找所有使能的unit文件,同时可以通过systemctl preset-all复位所有使能的unitfile。

如上问题还是只有从man systemctl 当中找答案哦。

systemd command

systemctl (1)        - Control the systemd system and service manager
systemd (1)          - systemd system and service manager
systemd-activate (8) - Test socket activation of daemons
systemd-analyze (1)  - Analyze system boot-up performance
systemd-ask-password (1) - Query the user for a system password
systemd-ask-password-console.path (8) - Query the user for system passwords on the console and via wall
systemd-ask-password-console.service (8) - Query the user for system passwords on the console and via wall
systemd-ask-password-wall.path (8) - Query the user for system passwords on the console and via wall
systemd-ask-password-wall.service (8) - Query the user for system passwords on the console and via wall
systemd-backlight (8) - Load and save the display backlight brightness at boot and shutdown
systemd-backlight@.service (8) - Load and save the display backlight brightness at boot and shutdown
systemd-binfmt (8)   - Configure additional binary formats for executables at boot
systemd-binfmt.service (8) - Configure additional binary formats for executables at boot
systemd-bootchart (1) - Boot performance graphing tool
systemd-cat (1)      - Connect a pipeline or program's output with the journal
systemd-cgls (1)     - Recursively show control group contents
systemd-cgtop (1)    - Show top control groups by their resource usage
systemd-cryptsetup (8) - Full disk decryption logic
systemd-cryptsetup-generator (8) - Unit generator for /etc/crypttab
systemd-cryptsetup@.service (8) - Full disk decryption logic
systemd-debug-generator (8) - Generator for enabling a runtime debug shell and masking specific units at boot
systemd-delta (1)    - Find overridden configuration files
systemd-detect-virt (1) - Detect execution in a virtualized environment
systemd-efi-boot-generator (8) - Generator for automatically mounting the EFI System Partition used by the current boot to /boot
systemd-escape (1)   - Escape strings for usage in system unit names
systemd-fsck (8)     - File system checker logic
systemd-fsck-root.service (8) - File system checker logic
systemd-fsck@.service (8) - File system checker logic
systemd-fstab-generator (8) - Unit generator for /etc/fstab
systemd-getty-generator (8) - Generator for enabling getty instances on the console
systemd-gpt-auto-generator (8) - Generator for automatically discovering and mounting root, /home and /srv partitions, as well as discovering and enabling swap partitions, based on GPT par...
systemd-halt.service (8) - System shutdown logic
systemd-hibernate.service (8) - System sleep state logic
systemd-hostnamed (8) - Host name bus mechanism
systemd-hostnamed.service (8) - Host name bus mechanism
systemd-hybrid-sleep.service (8) - System sleep state logic
systemd-inhibit (1)  - Execute a program with an inhibition lock taken
systemd-initctl (8)  - /dev/initctl compatibility
systemd-initctl.service (8) - /dev/initctl compatibility
systemd-initctl.socket (8) - /dev/initctl compatibility
systemd-journald (8) - Journal service
systemd-journald-dev-log.socket (8) - Journal service
systemd-journald.service (8) - Journal service
systemd-journald.socket (8) - Journal service
systemd-kexec.service (8) - System shutdown logic
systemd-localed (8)  - Locale bus mechanism
systemd-localed.service (8) - Locale bus mechanism
systemd-logind (8)   - Login manager
systemd-logind.service (8) - Login manager
systemd-machine-id-setup (1) - Initialize the machine ID in /etc/machine-id
systemd-machined (8) - Virtual machine and container registration manager
systemd-machined.service (8) - Virtual machine and container registration manager
systemd-modules-load (8) - Configure kernel modules to load at boot
systemd-modules-load.service (8) - Configure kernel modules to load at boot
systemd-networkd (8) - Network manager
systemd-networkd-wait-online (8) - Wait for network to come online
systemd-networkd-wait-online.service (8) - Wait for network to come online
systemd-networkd.service (8) - Network manager
systemd-notify (1)   - Notify service manager about start-up completion and other daemon status changes
systemd-nspawn (1)   - Spawn a namespace container for debugging, testing and building
systemd-path (1)     - List and query system and user paths
systemd-poweroff.service (8) - System shutdown logic
systemd-quotacheck (8) - File system quota checker logic
systemd-quotacheck.service (8) - File system quota checker logic
systemd-random-seed (8) - Load and save the system random seed at boot and shutdown
systemd-random-seed.service (8) - Load and save the system random seed at boot and shutdown
systemd-readahead (8) - Disk read ahead logic
systemd-readahead-collect.service (8) - Disk read ahead logic
systemd-readahead-done.service (8) - Disk read ahead logic
systemd-readahead-done.timer (8) - Disk read ahead logic
systemd-readahead-replay.service (8) - Disk read ahead logic
systemd-reboot.service (8) - System shutdown logic
systemd-remount-fs (8) - Remount root and kernel file systems
systemd-remount-fs.service (8) - Remount root and kernel file systems
systemd-resolved (8) - Network Name Resolution manager
systemd-resolved.service (8) - Network Name Resolution manager
systemd-rfkill (8)   - Load and save the RF kill switch state at boot and shutdown
systemd-rfkill@.service (8) - Load and save the RF kill switch state at boot and shutdown
systemd-run (1)      - Run programs in transient scope or service units
systemd-shutdown (8) - System shutdown logic
systemd-shutdownd (8) - Scheduled shutdown service
systemd-shutdownd.service (8) - Scheduled shutdown service
systemd-shutdownd.socket (8) - Scheduled shutdown service
systemd-sleep (8)    - System sleep state logic
systemd-sleep.conf (5) - Suspend and hibernation configuration file
systemd-socket-proxyd (8) - Bidirectionally proxy local sockets to another (possibly remote) socket.
systemd-suspend.service (8) - System sleep state logic
systemd-sysctl (8)   - Configure kernel parameters at boot
systemd-sysctl.service (8) - Configure kernel parameters at boot
systemd-system-update-generator (8) - Generator for redirecting boot to offline update mode
systemd-system.conf (5) - System and session service manager configuration file
systemd-sysusers (8) - Allocate system users and groups
systemd-sysusers.service (8) - Allocate system users and groups
systemd-timedated (8) - Time and date bus mechanism
systemd-timedated.service (8) - Time and date bus mechanism
systemd-timesyncd (8) - Network Time Synchronization
systemd-timesyncd.service (8) - Network Time Synchronization
systemd-tmpfiles (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-clean.service (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-clean.timer (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-setup-dev.service (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tmpfiles-setup.service (8) - Creates, deletes and cleans up volatile and temporary files and directories
systemd-tty-ask-password-agent (1) - List or process pending systemd password requests
systemd-udevd (8)    - Device event managing daemon
systemd-udevd-control.socket (8) - Device event managing daemon
systemd-udevd-kernel.socket (8) - Device event managing daemon
systemd-udevd.service (8) - Device event managing daemon
systemd-update-utmp (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp-runlevel.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-user-sessions (8) - Permit user logins after boot, prohibit user logins at shutdown
systemd-user-sessions.service (8) - Permit user logins after boot, prohibit user logins at shutdown
systemd-user.conf (5) - System and session service manager configuration file
systemd.automount (5) - Automount unit configuration
systemd.device (5)   - Device unit configuration
systemd.directives (7) - Index of configuration directives
systemd.exec (5)     - Execution environment configuration
systemd.index (7)    - List all manpages from the systemd project
systemd.journal-fields (7) - Special journal fields
systemd.kill (5)     - Process killing procedure configuration
systemd.link (5)     - Network device configuration
systemd.mount (5)    - Mount unit configuration
systemd.netdev (5)   - Virtual Network Device configuration
systemd.network (5)  - Network configuration
systemd.path (5)     - Path unit configuration
systemd.preset (5)   - Service enablement presets
systemd.resource-control (5) - Resource control unit settings
systemd.scope (5)    - Scope unit configuration
systemd.service (5)  - Service unit configuration
systemd.slice (5)    - Slice unit configuration
systemd.snapshot (5) - Snapshot unit configuration
systemd.socket (5)   - Socket unit configuration
systemd.special (7)  - Special systemd units
systemd.swap (5)     - Swap unit configuration
systemd.target (5)   - Target unit configuration
systemd.time (7)     - Time and date specifications
systemd.timer (5)    - Timer unit configuration
systemd.unit (5)     - Unit configuration

systemd source review

jaysnote/systemd.1548335307.txt.gz · 最后更改: 2021/06/22 23:14 (外部编辑)