第三十四天

一、linux任务计划cron

110527_r22I_3769316.png

1、crontab -u(指定用户)、-e(进入配置文件)、-l(列出)、-r(删除)

2、格式:分 时 日 月 周 user command

3、文件/var/spool/cron/username

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

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

6、可用格式1,2,3表示1或者2或者3

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

8、要保证服务是启动状态

9、systemctl start crond.service

 

 

二、chkconfig工具

1、chkconfig --list

111917_Y1Zt_3769316.png

2、chkconfig --level 3 network off

3、chkconfig --level 345 network off 指定某一个或多个级别关闭或开启

4、chkconfig --del network 删除脚本

5、chkconfig --add network 加入新的脚本

 

 

三、systemd管理服务

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

113643_kuwS_3769316.png

2、几个常用的服务相关的命令

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

4、systemctl disable crond  //不让开机启动

5、systemctl status crond  //查看状态

114702_WC0a_3769316.png

6、systemctl stop crond  //停止服务

7、systemctl start crond  //启动服务

8、systemctl restart crond  //重启服务

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

114729_Qjrd_3769316.png

 

 

四、unit介绍

1、ls /usr/lib/systemd/system  //系统所有unit,分为以下类型

2、service 系统服务

3、target 多个unit组成的组

4、device 硬件设备

5、mount 文件系统挂载点

6、automount 自动挂载点

7、path  文件或路径

8、scope  不是由systemd启动的外部进程

9、slice  进程组

10、snapshot systemd 快照

11、socket  进程间通信套接字

12、swap  swap文件

13、timer  定时器

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

150407_rxJA_3769316.png

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

16、systemctl list-units --all --state=inactive  //列出inactive的unit

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

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

 

 

五、target介绍

1、系统为了方便管理用target管理unit

2、systemctl list-unit-files --type=target  列出所有target

154137_Yyez_3769316.png

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

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

5、systemctl set-default multi-user.target

6、一个service属于一种类型的unit

7、多个unit组成了一个target

8、cat /usr/lib/systemd/system/sshd.service  //看【install】部分

 

 

 

 

转载于:https://my.oschina.net/u/3769316/blog/1786301

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值