zoukankan      html  css  js  c++  java
  • Linux centos7 linux任务计划cron、chkconfig工具、systemd管理服务、unit介绍、 target介绍

    一、linux任务计划cron

    crontab -u  -e -l -r

    格式;分 时 日 月 周 user command

    文件/var/spool/corn/username

    分范围0-59,时范围0-23,日范围0-31,月范围0-12,周1-6

    可用格式1-5表示一个范围1到5

    可用格式1,2,3表示1或2或3

    可用格式*/2表示被2整除的数字,比如小时,那就是每隔2小时

    启动

    systemctl etop crond停止

    systemctl start crond.service

     二、chkconfig工具

    chkconfig --list

    chkconfig --level 3 network off

    chkconfig --level 345 network off

     

    chkconfig --del network

    chkconfig --add network

     

    三、systemd管理服务,是linux下的一种init软

    systemctl list-units --all --type=service

    几个常用服务相关指令

    systemctl enable crond.service 让服务机开机启动

    systemctl disable crond 不让开机启动

    systemctl status crond 查看状态

    systemctl stop crond 停止服务

    systemctl restart crond重启服务

    systemctl is-enabled crond检查服务是否开机启动

    三、unit介绍

    ls /usr/lib/systemd/system 系统所有unit

    service系统服务

    target多个unit组成的组

    device硬件设备

    mount文件系统挂载点

    automount自动挂载点

    path文件或路径

    scop不是由systemd启动的外部进程

    slice进程组

    snapshot systemd快照

    socket进程间通信套接字

    swap 文件

    timer定时器

    unit 相关指令

    systemctl list-units 列出正在运行的unit

    systemctl list-units --all列出所有,包括失败的或者inactive

    systemctl list-units --all --state=inactive 列出inactive的service

    systemctl list-units --type=service 列出状态为active的service

    systemctl is-active crond.service 查看谋个服务是否为active

     

    四、target介绍

    系统未来方便用target来管理unit

    systemctl list-unit-files --type=target 指定target

    systemctl list-dependencies mulit-user.target 查看指定target下有哪些unit

    systemctl get-default 查看系统默认的target

    systemctl set-default multi-user.target

    一个service属于一种类型的unit

    多个uniy组成了一个target

    一个target里面包含多个service

    cat /usr/lib/systemd/system/sshd.service 查看[install]部分

  • 相关阅读:
    洛谷 P3384 【模板】树链剖分
    codevs 4633 [Mz]树链剖分练习
    看一个人的回答有感(怎么判断数组中有没有未定义的值,如:[,,1,,3])
    bzoj2754: [SCOI2012]喵星球上的点名
    bzoj4456: [Zjoi2016]旅行者
    bzoj4574:Zjoi2016线段树 dp
    bzoj4455: [Zjoi2016]小星星
    bzoj4516: [Sdoi2016]生成魔咒
    uoj#207. 共价大爷游长沙
    bzoj4530:[Bjoi2014]大融合
  • 原文地址:https://www.cnblogs.com/davery/p/8811290.html
Copyright © 2011-2022 走看看