Systemd 简单记录 [附]:uwsgi实例
systemd 是一款与系统高耦合的管理软件
系统管理
systemctl
# 关机
systemctl poweroff
# 重启
systemctl reboot
# 暂停系统
systemctl suspend
# 单用户状态(救援状态)
systemctl rescue
systemd-analyze
# 查看服务启动耗时
systemd-analyze blame
# 查看系统启动耗时
systemd-analyze
# 显示指定服务的启动流
systemd-analyze critical-chain xxx.service
localectl
# 查看本地设置
localectl
# 设置本地参数
localectl set-locale LANG=en_GB.utf8
timedatectl
# 查看当前时区
timedatectl
# 显示可用时区列表
timedatectl list-timezones
# 设置时区
timedatectl set-timezone Asia/Shanghai
hostnamectl
# 显示当前主机名
hostnamectl
# 设置主机名
hostnamectl set-hostname your-host-name
loginctl
# 显示当前登录的用户列表
loginctl list-users
# 显示指定用户的信息
loginctl show-user username
Unit
系统中不同的资源统称为 Unit
unit 分类
- service :系统服务
- socket :进程通信, 套接字单元
- target :多个unit构成的组
- device :硬件设备
- swap : swap文件
- mount :文件系统挂载点
- automount :自动挂载点
- path :路径
- scope :非systemd启动的外部进程
- slice: 进程组
- snapshot:systemd快照
- timer :定时器
systemctl list-units
# 列出正在运行的 unit
systemctl list-units
# 列出所有的unit
systemctl list-units --all