学习笔记 三: 用systemd管理服务

一 systemd基本知识

  systemd再同一时间,启动 

提高启动速度系统资源,系统服务,其它进程

 自动服务依赖管理


systemctl -l help





  1. systemd基本管理unit

Service unit   .service A system service.

Target unit    .target A group of systemd units.

Automount unit .automount A file system automount point.

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

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



本文转自 woshiwei201 51CTO博客,原文链接:http://blog.51cto.com/chenwei/1841958

上一篇:如何确认客户使用的Spartacus库文件是未经修改过的原始版本


下一篇:多态简介 | Python从入门到精通:高阶篇之三十三