學習筆記 三: 用systemd管理服務

一 systemd基本知識ssh

  systemd再同一時間,啓動 socket

提升啓動速度系統資源,系統服務,其它進程ide

 自動服務依賴管理操作系統


systemctl -l help
進程





  1. systemd基本管理unitip

Service unit   .service A system service.ci

Target unit    .target A group of systemd units.資源

Automount unit .automount A file system automount point.get

Device unit    .device A device file recognized by the kernel.it

Mount unit     .mount A file system mount point.

Path unit      .path A file or directory in a file system.

Scope unit     .scope An externally created process.

Slice unit     .slice A group of hierarchically organized units

that manage system processes.

Snapshot unit  .snapshot A saved state of the systemd manager.

Socket unit    .socket An inter-process communication socket.

Swap unit      .swap A swap device or a swap file.

Timer unit     .timer A systemd timer.



2.相關配置文件

/usr/lib/systemd/system


/run/systemd/system/


/etc/systemd/system/


runnerlevel



3.服務啓動中止命令 systemctl  

start

stop 

status


systemctl stop bluetooth.service



4.顯示全部服務狀態

systemctl list-units --type service --all


systemctl --failed --type=service


systemctl status sshd.service




5.添加自動啓動

systemctl enable name.service




6. 查看target

sytemctl list-units --type target


systemctl list-units --type target --all





7.更改target

systemctl set-default multi-user.target



8.重啓操做系統

systemctl halt

systemctl poweroff

systemctl reboot


9.配置系統啓動

graphical.target  :system supports multiple users,graphical and text-based

multi-user.target  : system supports multiple users,text-based logins only

rescue.target  sulogin prompt,basic system initialization completed.

emergency.target :sulogin prompt,initramfs pivot complete and system root mounted on /read


systemctl list-dependencies graphical.target | grep target

相關文章
相關標籤/搜索