zoukankan      html  css  js  c++  java
  • linux 基础11-例行性命令

    1. 什么是例行性命令

    1.1 linux工作排程的种类:

    linux例行性命令主要有两种:

    • at:仅执行一次就从linux的任务中取消
    • cron:将持续例行性的工作下去

    1.2 系统常见的例行性命令有哪些:

    2. 仅执行一次的工作排程

    建立date.sh
    #!/bin/bash
    #program: this program to show time like: yyy-mm-dd hh-mm-ss AM/PM
    #history:
    #2009-10-07 first realease lin xiyu

    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
    echo "Today is 'date +%F %r'"
    

    给test1用户发送邮件
    at 16:57
    at>/bin/mail -s "'/bin/bash /root/date.sh'" test1
    at>
    job 48 at 2009-10-07 16.57

    ls -ls /var/spool/at  #显示该目录下的at例行性命令
    
    mail #在test1用户中查询邮件
    t 1  #全部显示第一封邮件
    x  #退出
    
    
    ls /etc/ | grep at  #显示/etc目录下所有含有at字符的文件
    

    第二种

    vi t1.txt
    at 17:05 2009-10-07
    at>/bin/mail -s "'/bin/bash /root/date.sh'" test1<t1.txt
    at> <EOT> 
    job 48 at 2009-10-07 17:05    
    

    第三种和-m的解释

    at -m 05:07pm october 7
    at>/bin/mail -s "'/bin/bash /root/date.sh'" test1<t1.txt
    at> <EOT> 
    job 48 at 2009-10-07 17:05   
    

    第四种:

    at -m now + 1 minute
    at>/bin/mail -s "'/bin/bash /root/date.sh'" test1<t1.txt
    at> <EOT> 
    job 48 at 2009-10-07 17:05   
    

    3. 循环执行的例行性命令

    3.1 使用者设定:

    3.2 系统设定:

  • 相关阅读:
    Codeforces Round #251 (Div. 2) A
    topcoder SRM 623 DIV2 CatAndRat
    topcoder SRM 623 DIV2 CatchTheBeatEasy
    topcoder SRM 622 DIV2 FibonacciDiv2
    topcoder SRM 622 DIV2 BoxesDiv2
    Leetcode Linked List Cycle II
    leetcode Linked List Cycle
    Leetcode Search Insert Position
    关于vim插件
    Codeforces Round #248 (Div. 2) B. Kuriyama Mirai's Stones
  • 原文地址:https://www.cnblogs.com/agui125/p/10056399.html
Copyright © 2011-2022 走看看