linux任务计划系统级别命令,linux任务计划、chkconfig,systemctl介绍及常用命令 ,unit和target介绍...

10月30日任务

10.23 linux任务计划cron

10.24 chkconfig工具

10.25 systemd管理服务

10.26 unit介绍

10.27 target介绍

1. linux任务计划cron

3560d528e2ff4c15f10323b4bfcb63e5.png

#cat /etc/crontab 任务计划的配置文件

10c3fbc034926a7e19e730f5ecf1905c.png

#crontab -e 命令,进入crontab配置文件,去定义

56b933f10a497fc82b5dad733cc4440a.png

#systemctl start crond 启动该服务

#ps aux |grep cron 查看

b615b2f6b02483b61d09cb9529c6c4e8.png

#systemctl status crond 查看crond状态

9e338da3de852f9a73d5308567ea42e7.png

#crontab -l 查看增加的任务计划

/var/spool/cron/root 是它的保存位置

253c9cbd3b79457f3c3824da7830bfa9.png

#crontab -r 删除

#crontab -u root -l 指定一个用户

2.chkconfig工具

efe12f95621f91a9f420cfcd4812f267.png

#chkconfig --list 查看当前使用chkconfig工具的服务有哪些

e1549b59ef3639cd53d33f4c1d82e012.png

ls /etc/init.d/ 存放位置

befdcc864d5c131337717b70ce62ef85.png

#chkconfig network off 关闭network服务

#chkconfig --level 345 network off 指定network服务在345级别下关闭

#chkconfig --del network  删除

#chkconfig --add network 添加

3.systemd管理服务

7dfc363e779ac0581445437b3c1da2d2.png

#systemctl list-units --all --type=service 查看所有使用service工具的服务

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

#systemctl disable crond 不让开机启动

#systemctl status crond 查看状态

#systemctl stop crond 停止服务

#systemctl start crond 启动服务

#systemctl restart crond 重启服务

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

4. unit介绍

27eb348109c8b1ac25b7ecfa1caac8c0.png

e8f3631e829bcde0edfc5bce9db23979.png

#systemctl list-units 列出整租运行的unit

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

#systemctl list-units --all --state=inactive 列出inactive的unit

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

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

5.target介绍

923e0807cf6bc33140625384170f2d6a.png

#systemctl list-unit-files --type=target 列出系统所有的target

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

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

#systemctl set-default multi-user.target 设置一个默认的target

一个service属于一种类型的unit

多个unit组成了一个target

一个target里面包含了多个service

#cat /etc/lib/systemd/system/sshd.service  查看【install】部分

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值