linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍

10.23 linux任务计划cron
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
任务计划在linux下是必不可少的,它可能是一个脚本,也可能是一个命令,不管那种形式都得有一个时间去执行它
crontab配置文件下面的5个*位置的解释
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
crontab -e定义文件,用法是跟vi编辑文件一样的
0晨3点去执行这个命令的脚本
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
1-10号的3点执行这个脚本
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
双月的1-10号执行这个脚本
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
双月的周二和周五才执行这个脚本
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
重启服务后,查看是否有这个服务
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
查看服务的状态是绿色,显示runing正明这个服务正常启动
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
如果任务没有执行很有可能是命令没有用绝对路径,因为用的命令不在变量PATH里,所以要么使用绝对路径,要么将命令加入到PATH变量里
每一个执行的脚本最好都写上追加正确与错误的内容到指定的文件,这样就可以有迹可寻,当有错误时可以查看下错误的文件日志就知道了
备份脚本的内容,可以把下面的root直接拷贝就行了,如果是user用户就会是user名称的文件
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
crontab -r是删除脚 本
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
10.24 chkconfig工具
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
这个工具在centos7里面已经作为过渡版本了,只剩下这2个服务了
0-6级别的状态
0表示关机
1表示 单用户模式
2 表示多用用户模式,只不过比3少了nfs服务 ,nfs是一种网络文件系统
3表示多用户模式,只不过不带图形
4表示保留的状态 ,暂时没用
5表示多用户模式,而且是带图形
6级别是重启
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍

这2个服务脚本的位置在这个目录下
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
把network开启的服务状态更改为关闭的状态
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
把network关闭的服务状态更改为开启的状态
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
加入服务到列表里,首先要把123放到 /etc/init.d/目录下linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
再添加这个123这个服务脚本到列表下
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
启动123文件是有要求的,首先它是一个脚本
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
删除一个服务
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
10.25 systemd管理服务
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
10.26 unit介绍
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
unit相关的命令
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍
10.27 target介绍
linux任务计划cron chkconfig工具systemd管理服务unit介绍target介绍

扩展

  1. anacron http://blog.csdn.net/strikers1982/article/details/4787226
  2. xinetd服(默认机器没有安装这个服务,需要yum install xinetd安装) http://blog.sina.com.cn/s/blog_465bbe6b010000vi.html
  3. systemd自定义启动脚本 http://www.jb51.net/article/100457.htm

转载于:https://blog.51cto.com/13450039/2066578

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值