美文网首页
第23课 定时任务上部 2019-04-26

第23课 定时任务上部 2019-04-26

作者: 苏水的北 | 来源:发表于2019-05-03 08:42 被阅读0次
第五周day5.png

1、sudo(尚方宝剑)命令的用用法:

[root@oldboyedu59 ~]# grep oldboy /etc/sudoers
oldboy  ALL=(ALL)       /bin/ls, /bin/touch
[oldboy@oldboyedu59 ~]$ sudo -l
[sudo] password for oldboy: 
User oldboy may run the following commands on oldboyedu59:
    (ALL) /bin/ls, /bin/touch
[oldboy@oldboyedu59 ~]$ ls /root/
ls: cannot open directory /root/: Permission denied
[oldboy@oldboyedu59 ~]$ sudo ls /root/
alex  anaconda-ks.cfg  dir-032  dir-035  file-032  file-035  oldboydir  oldboy.txt  pass.txt  passwd.txtdd2  sed.sed 
sudo练习题 :

给oldboy配置sudo可以查看系统的日志 (思考查看日志有什么命令)
/bin/grep, /bin/head, /bin/tail, /bin/less, /bin/more, /bin/cat

[root@oldboyedu59 ~]# grep oldboy /etc/sudoers
#oldboy  ALL=(ALL)       /bin/ls, /bin/touch
oldboy  ALL=(ALL)       /bin/grep, /bin/head, /bin/tail, /bin/less, /bin/more, /bin/cat

给oldboy配置可以运行/bin下面所有命令
oldboy ALL=(ALL) /bin/*

给oldboy配置可以运行/bin下面所有命令但是不能使用vi和su
oldboy ALL=(ALL) /bin/*, !/bin/vi, !/bin/su, !/bin/rm

给oldboy配置可以运行系统中所有命令并且不需要再输入oldboy密码
oldboy ALL=(ALL) NOPASSWD: ALL

2、简单定时任务的时间格式:

每天8:30 开始上课(go to school)
30 08 * * * go to school

每天晚上12点带远导去 dbj
每个月的1号晚上11点带guoav去看av (kan)
0 2 * * 1 /data/postmall/shell/a.sh表示什么含义?

每天晚上12点带远导去 dbj

  • 00 * * * dbj #半夜12点00到半夜12点59分 每分钟一次
    00 00 * * * dbj #每天的半夜12点整

每个月的1号晚上11点带guoav去看av (kan)
00 23 01 * * kan

0 2 * * 1 /data/postmall/shell/a.sh表示什么含义?
每周1的凌晨2点整 执行脚本

3、今日提示集合:

"/etc/sudoers.tmp" 125L, 4588C written

/etc/sudoers: syntax error near line 105 <<<
语法错误 在105行

[sudo] password for oldboy:
Sorry, user oldboy may not run sudo on oldboyedu59.

  1. [root@oldboyedu59 ~]# crontab -l
    no crontab for root
    root用户没有定时任务

2.no crontab for root - using an empty one
root用户没有定时任务 创建1个空的文件

3.crontab: installing new crontab
更新定时任务规则

相关文章

  • 第23课 定时任务上部 2019-04-26

    1、sudo(尚方宝剑)命令的用用法: sudo练习题 : 给oldboy配置sudo可以查看系统的日志 (思考查...

  • nginx日志切割脚本

    nginx日志切割脚本,在Linux上部署成crond定时任务,0点执行会进行日志切割

  • day 17

    第13章 Linux系统定时任务Cron(d)服务应用实践 1.1、Linux定时任务 1.1.1、什么是定时任务...

  • 服务器部署定时任务 Crontab

    Time: 2017.9.19 在服务器上部署定时任务,使用crontab命令,即Cron配置文件称为“cront...

  • 2019-07-31定时任务

    定时任务 定时任务实现方法 系统默认定时任务 用户自定义设置定时任务 定时任务配置文件 定时任务启动 定时任务样例...

  • crontab 定式调度

    @(Linux 命令脚本) 今天在写脚本在几十个机器上部署,需要通过脚本在 crontab 中新加定时任务查了下,...

  • 分布式定时调度-xxl-job

    一、定时任务概述 1.1 定时任务认识 1.1.1 什么是定时任务 定时任务是按照指定时间周期运行任务。使用场景为...

  • day 22 操作系统定时任务

    系统定时任务概念==生活中闹钟 系统定时任务实现方法: 实现定时任务配置: 定时任务如何进行设置 定时任务编写常见...

  • 框架篇-定时任务(一) - JDK Timer

    1.定时任务(Timer) 参考《可伸缩服务架构 框架与中间件 第6章》 1.1 前言 什么定时任务在我们生活中有...

  • 7月30日 定时任务

    定时任务 代替人自动完成一些任务 定时任务实现的方法 定时任务软件:cronie定时任务软件:atd --- 设...

网友评论

      本文标题:第23课 定时任务上部 2019-04-26

      本文链接:https://www.haomeiwen.com/subject/lnlanqtx.html