您的位置:首页 > 其它

speed up li off and systemctl

2018-01-31 00:05 447 查看
systemctl list-units --type=service 显示所有已启动的服务

systemctl list-unit-files --type=service | grep enabled 列出开机启动项centos有chkconfig  ubuntu有类似的sysv-conf但用sysv-conf禁用后用systemctrl还是有的能够启动
好像是最新的命令chkconfig service等都合并为systemctrl了 systemctrl为systemd的一个工具就如ifconfig和ip新旧命令 http://blog.csdn.net/example440982/article/details/51794440 systemctrl介绍
systemctl命令是系统服务管理器指令,它实际上将 service和 chkconfig 这两个命令组合到一起。
停用的服务进程仍然能够被另外一个服务进程启动。如果你真的想在任何情况下系统启动时都不启动该进程,无需卸载该它,只需要把它掩盖起来就可以阻止该进程在任何情况下开机启动。
$ sudo systemctl mask bluetooth.service

Created symlink from /etc/systemd/system/bluetooth.service to /dev/null.

sudo systemctl unmask bluetooth.service后重启比如vm关掉不能运行


一旦你对禁用该进程启动而没有出现负面作用感到满意,你也可以选择卸载该程序。

这里举例了几个服务进程的作用。许多服务进程都是发行版特定的,所以你应该看看你的发行版文档(比如通过 google 或 StackOverflow)。
accounts-daemon.service 是一个潜在的安全风险。它是 AccountsService 的一部分,AccountsService 允许程序获得或操作用户账户信息。我不认为有好的理由能使我允许这样的后台操作,所以我选择掩盖mask该服务进程。
avahi-daemon.service 用于零配置网络发现,使电脑超容易发现网络中打印机或其他的主机,我总是禁用它,别漏掉它。
brltty.service 提供布莱叶盲文设备支持,例如布莱叶盲文显示器。
debug-shell.service 开放了一个巨大的安全漏洞(该服务提供了一个无密码的 root shell ,用于帮助 调试 systemd 问题),除非你正在使用该服务,否则永远不要启动服务。
ModemManager.service 该服务是一个被 dbus 激活的守护进程,用于提供移动宽频broadband(2G/3G/4G)接口,如果你没有该接口,无论是内置接口,还是通过如蓝牙配对的电话,以及 USB 适配器,那么你也无需该服务。
pppd-dns.service 是一个计算机发展的遗物,如果你使用拨号接入互联网的话,保留它,否则你不需要它。
rtkit-daemon.service 听起来很可怕,听起来像是 rootkit。 但是你需要该服务,因为它是一个实时内核调度器real-time kernel scheduler。
whoopsie.service 是 Ubuntu 错误报告服务。它用于收集 Ubuntu 系统崩溃报告,并发送报告到 https://daisy.ubuntu.com 。 你可以放心地禁止其启动,或者永久的卸载它。
wpa_supplicant.service[/b] 仅在你使用 Wi-Fi 连接时需要。

那么如何找出拖慢开机速度的元凶并将其禁用呢?

systemd自带分析利器systemd-analyze

systemd-analyze有一些参数,大体上来讲就是一些功能, 可以用
man systemd-analyze
其中, 对我们比较有用的参数就是blame。
blame : blame是"指责"的意思。
 同理, systemd-analyze blame就是显示开机启动项的时间, 从最慢依次列出。
然后有选择的禁用切忌不要把系统核心的给禁用了,
systemctrl disable xxx但有的无法disable只能用mask了也就是说 mask 选项把 service 直接软链接到了 /dev/null 这个著名的「黑洞」中去了,然后世界就清净了。

开机不检查磁盘,vi /etc/fstab 把/dev/sda2的0 1 改为0 0
任务旧指令新指令
使某服务自动启动chkconfig
--level 3 httpd on
systemctl enable httpd.service
使某服务不自动启动chkconfig --level 3 httpd offsystemctl disable
httpd.service
检查服务状态service httpd statussystemctl status httpd.service
(服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
显示所有已启动的服务chkconfig --listsystemctl list-units --type=service
启动某服务service
httpd start
systemctl start httpd.service
停止某服务service httpd stopsystemctl
stop httpd.service
重启某服务service httpd restartsystemctl restart httpd.service
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐