13 ,定时任务 ( 考题 )

版权声明:欢迎大家学习讨论,拒绝盗版 https://blog.csdn.net/qq_34319644/article/details/90904636

1 ,使用 crontab 命令做定时任务的时候,可以精确到秒吗 ( )

2 ,请同学们在 /root 目录下创建一个文件,文件名是 ds.txt

3 ,编写定时任务 : 每分钟,执行以下命令 (echo 333>>/root/ds.txt)

4 ,编写定时任务 : 每天的 16:08,执行以下命令 (echo 444>>/root/ds.txt)

5 ,编写定时任务 : 每个月 2 号的 08:00,执行以下命令 (echo 555>>/root/ds.txt)

6 ,编写定时任务 : 每个整点,执行以下命令 (echo 666>>/root/ds.txt)

7 ,编写定时任务 : 每个 5,10,15,20 … 分的时候,执行以下命令 (echo 777>>/root/ds.txt)

8 ,编写定时任务 : 每个小时的 36-40 分,执行以下命令 (echo 888>>/root/ds.txt)

9 ,编写定时任务 : 每个小时的 1,2,3,6,7,8 分的时候,执行以下命令 (echo 9999>>/root/ds.txt)

10 ,以下命令 :【 30 4 * * 3 mycmd 】 ,请问这个命令每隔多久执行一次 ( )

11 ,以下命令 :【 */5 * * * * mycmd 】 ,请问这个命令每隔多久执行一次 ( )

12 ,定时任务的中设计到的路径,推荐要用 ( ) 路径,减少错误。

13 ,注释是必要的吗?( )。为什么?( )



参考答案 :

  1. 不可以
  2. cd /root
    touch ds.txt
  3. crontab -e
* * * * * echo 333>> /root/ds.txt
  1. crontab -e
08 16 * * * echo 444>> /root/ds.txt
  1. crontab -e
00 08 02 * * echo 555>> /root/ds.txt
  1. crontab -e
00 * * * * echo 666>> /root/ds.txt
  1. crontab -e
*/5 * * * * echo 777>> /root/ds.txt
  1. crontab -e
36-40 * * * * echo 888>>/root/ds.txt
  1. crontab -e
1,2,3,6,7,8 * * * * echo 999>> /root/ds.txt
  1. 每周
  2. 5 分钟
  3. 绝对
  4. 是 ,因为规范比技术更重要

猜你喜欢

转载自blog.csdn.net/qq_34319644/article/details/90904636