10月30日任务
10.23 linux任务计划cron
10.24 chkconfig工具
10.25 systemd管理服务
10.26 unit介绍
10.27 target介绍
1. linux任务计划cron
#cat /etc/crontab 任务计划的配置文件
#crontab -e 命令,进入crontab配置文件,去定义
#systemctl start crond 启动该服务
#ps aux |grep cron 查看
#systemctl status crond 查看crond状态
#crontab -l 查看增加的任务计划
/var/spool/cron/root 是它的保存位置
#crontab -r 删除
#crontab -u root -l 指定一个用户
2.chkconfig工具
#chkconfig --list 查看当前使用chkconfig工具的服务有哪些
ls /etc/init.d/ 存放位置
#chkconfig network off 关闭network服务
#chkconfig --level 345 network off 指定network服务在345级别下关闭
#chkconfig --del network 删除
#chkconfig --add network 添加
3.systemd管理服务
#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介绍
#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介绍
#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】部分