zoukankan      html  css  js  c++  java
  • 【原创】Linux基础之chkconfig systemd

    CentOS6服务用chkconfig控制,CentOS7改为systemd控制

    1 systemd

    systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points, and implements an elaborate transactional dependency-based service control logic. systemd supports SysV and LSB init scripts and works as a replacement for sysvinit. Other parts include a logging daemon, utilities to control basic system configuration like the hostname, date, locale, maintain a list of logged-in users and running containers and virtual machines, system accounts, runtime directories and settings, and daemons to manage simple network configuration, network time synchronization, log forwarding, and name resolution.

    service位于/usr/lib/systemd/system/

    列出所有的unit

    # systemctl list-unit-files
    # systemctl list-unit-files --type=service

    启动、停止、重启、查询状态

    # systemctl start docker
    # systemctl stop docker
    # systemctl restart docker
    # systemctl status docker

    查看日志

    # journalctl -u docker
    # journalctl -u docker -f

    开机启动设置、取消

    # systemctl enable docker
    # systemctl disable docker

    参考:https://www.freedesktop.org/wiki/Software/systemd/

    2 chkconfig

    chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories.

    This implementation of chkconfig was inspired by the chkconfig command present in the IRIX operating system. Rather than maintaining configuration information outside of the /etc/rc[0-6].d hierarchy, however, this version directly manages the symlinks in /etc/rc[0-6].d. This leaves all of the configuration information regarding what services init starts in a single location.

    chkconfig has five distinct functions: adding new services for management, removing services from management, listing the current startup information for services, changing the startup information for services, and checking the startup state of a particular service.

    将service放到目录/etc/init.d/

    列出服务

    # chkconfig --list

    添加、删除服务

    # chkconfig --add httpd
    # chkconfig --del httpd

    开机启动设置、取消

    # chkconfig httpd on
    # chkconfig httpd off

    参考:https://linux.die.net/man/8/chkconfig

  • 相关阅读:
    2018-2019-1 20165212 《信息安全系统设计基础》第九周学习总结
    12321
    实现mybash
    2018-2019-1 20165212 《信息安全系统设计基础》第八周学习总结(pwd)
    2018-2019-1 20165212 实验三-并发程序设计
    2018-2019-1 20165212 20165222 20165313 实验二 固件程序设计
    2018-2019-1 20165212 《信息安全系统设计基础》第1次实验——实验环境的熟悉
    开根号(二分法、牛顿法)
    logistic回归的损失函数是什么形式?为什么?为什么不选平方损失函数?
    西瓜书课后习题——第六章
  • 原文地址:https://www.cnblogs.com/barneywill/p/10461279.html
Copyright © 2011-2022 走看看