码迷,mamicode.com
首页 > 其他好文 > 详细

SYSTEMD

时间:2017-09-19 11:08:59      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:systemd

八周一次课(9月18日)

10.23 linux任务计划cron

10.24 chkconfig工具

10.25 systemd管理服务

10.26 unit介绍

10.27 target介绍


10.23 linux任务计划cron

技术分享

配置文件位置/etc/crontab

 * * * * *  /bin/bash /tmp/1 > > /tmp/1 2>>/tmp/2 每分钟执行

0 3 1-10 */2 *  没两个月的1-10号的三点执行。

 systemctl start crond  启动服务。

注意:在写脚本的时候需要加上绝对路径。

[root@111 ~]# cat /var/spool/cron/root 

 * * * * *  echo "123" >/tmp/1

 计划任务存储的地方


10.24 chkconfig工具

cent7用systemd

技术分享

chkconfig管理的脚本的路径

chkconfig network off 关闭服务

系统分了七个级别 每个级别只有特定的服务是开启的。

chkconfig --list查看

[root@111 ~]# chkconfig --list


Note: This output shows SysV services only and does not include native

      systemd services. SysV configuration data might be overridden by native

      systemd configuration.


      If you want to list systemd services use ‘systemctl list-unit-files‘.

      To see services enabled on particular target use

      ‘systemctl list-dependencies [target]‘.


iprdump         0:off 1:off 2:on 3:on 4:on 5:on 6:off

iprinit         0:off 1:off 2:on 3:on 4:on 5:on 6:off

iprupdate       0:off 1:off 2:on 3:on 4:on 5:on 6:off

netconsole     0:off 1:off 2:off 3:off 4:off 5:off 6:off

技术分享

可以指定特定级别的服务关闭或者开启

自定义启动服务

第一步在/etc/init.d/ 下面建立自己的服务脚本

第二部 chkconfig --add 123

chkconfig --list

就可以实现开机自启服务

10.25 systemd管理服务

cent7的服务管理工具

技术分享

技术分享

列出所有的服务。

 systemctl enable  开机启动。

 systemctl is-enabled  XX查看某个服务是否开机自启

enable就会创建一个软连接。

10.26 unit介绍

技术分享

技术分享

技术分享

systemctl list-units --all列出所有的units

10.27 target介绍

技术分享

[root@111 system]# systemctl get-default 

graphical.target 查看默认的target 

[root@111 system]# systemctl set-default multi-user.target 

rm ‘/etc/systemd/system/default.target‘

ln -s ‘/usr/lib/systemd/system/multi-user.target‘ ‘/etc/systemd/system/default.target‘

开机就是命令行模式之前是图形界面模式。




SYSTEMD

标签:systemd

原文地址:http://zfno111.blog.51cto.com/10527763/1966488

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!