Process and Scheduled Tasks

Source: Internet
Author: User
Tags echo command

Process Concepts

内核的功用:进程管理,文件系统,网络功能,内存管理,驱动程序,安全功能等process:运行中的程序的一个副本,是被载入内存的一个指令集合    进程ID 号码被用来标记各个进程    UID,GID和SELinux语境决定对文件系统的存取和访问权限通常从执行进程的用户来继承    存在生命周期task struct:linux内核存储进程信息的数据结构格式task list:多个任务的task struct组成的链表进程创建:        init:第一个进程            父子关系        进程:都由其父进程创建,Cow fork() ,cione()

The basic state of the process

    创建状态:进程在创建时需要申请一个空白PCB(process control block进程控 制块),向其中填写控制和管理进程的信息,完成资源分配。     如果创建工作无法完 成,比如资源无法满足,就无法被调度运行,把此时进程所处状态称为创建状态就绪状态:进程已准备好,已分配到所需资源,只要分配到CPU就能够立即运行执行状态:进程处于就绪状态被调度后,进程进入执行状态阻塞状态:正在执行的进程由于某些事件(I/O请求,申请缓存区失败)而暂时    无法运行,进程受到阻塞。在满足请求时进入就绪状态等待系统调用终止状态:进程结束,或出现错误,或被系统终止,进入终止状态。无法再执行   

The basic state of the process

创建状态:进程在创建时需要申请一个空白PCB(process control block进程控 制块),向其中填写控制和管理进程的信息,完成资源分配。如果创建工作无法完 成,比如资源无法满足,就无法被调度运行,把此时进程所处状态称为创建状态就绪状态:进程已准备好,已分配到所需资源,只要分配到CPU就能够立即运行执行状态:进程处于就绪状态被调度后,进程进入执行状态无法运行,进程受到阻塞。在满足请求时进入就绪状态等待系统调用终止状态:进程结束,或出现错误,或被系统终止,进入终止状态。无法再执行   

Transitions between states six cases

运行——>就绪:1,主要是进程占用CPU的时间过长,而系统分配给该进程占 用CPU的时间是有限的;2,在采用抢先式优先级调度算法的系统中,当有更高 优先级的进程要运行时,该进程就被迫让出CPU,该进程便由执行状态转变为 就绪状态。就绪——>运行:运行的进程的时间片用完,调度就转到就绪队列中选择合适 的进程分配CPU运行——>阻塞:正在执行的进程因发生某等待事件而无法执行,则进程由执 行状态变为阻塞状态,如发生了I/O请求阻塞——>就绪:进程所等待的事件已经发生,就进入就绪队列以下两种状态是不可能发生的: 阻塞——>运行:即使给阻塞进程分配CPU,也无法执行,操作系统在进行调 度时不会从阻塞队列进行挑选,而是从就绪队列中选取就绪——>阻塞:就绪态根本就没有执行,谈不上进入阻塞态  

Process priority

进程优先级:     系统优先级:数字越小,优先级越高      0-139(CentOS4,5)    各有140个运行队列和过期队列      0-98,99(CentOS6)    实时优先级: 99-0   值最大优先级最高     nice值:-20到19,对应系统优先级100-139或99    Big O:时间复杂度,用时和规模的关系      O(1), O(logn), O(n)线性, O(n^2)抛物线, O(2^n)  

Process-related concepts

进程内存:Page Frame: 页框,用存储页面数据,存储Page 4k LRU:Least Recently Used 近期最少使用算法,释放内存物理地址空间和线性地址空间MMU:Memory Management Unit负责转换线性和物理地址TLB:Translation Lookaside Buffer 翻译后备缓冲器,用于保存虚拟地址和物理地址 映射关系的缓存 IPC: Inter Process Communication  同一主机: signal:信号 shm: shared memory  semaphore:信号量,一种计数器  不同主机:socket: IP和端口号     RPC: remote procedure call MQ:消息队列,Kafka,ActiveMQ   

Process status

Linux内核:抢占式做任务进程类型:        守护进程:daemon,再系统引导过程中启动的进程,和终端无关进程        前台进程:跟终端相关,通过终端启动的进程        注意:两者可以相互转换进程状态:        运行态:running        就绪态:ready        睡眠态:                可中断:interruptable                不可中断:uninterruptable停止态:stopped,暂停于内存,但不会被天调度,除非手动启动僵死态:zombie,结束进程,父进程结束前子进程不关闭

System Administration Tools

进程的分类:CPU-Bound:CPU密集型,非交互  

View Process Process PS

ps    支持三种选项:        UNIX选项:如 -A  -e        BSD选项: 如a        GNU选项 :如--help    选项:默认显示当前终端的进程        a 选项包括所有终端中的进程        x 选项包括不链接终端的进程        u 选项显示进程所有者信息        f 选项显示进程树,相当于 --forest        k|--sort 属性 对属性排序,属性前加- 表示倒序        o 属性... 选项显示定制的信息 pid cmd %cpu %mem        L 显示支持的属性列表

PS Common Options

-C cmdlist  指令命令,多个命令用 ,分割-L 显示进程-e 显示所有进程,相当于——A-f 显示完整格式程序信息-F 显示更完整的格式进程信息-H 以进程层级格式显示进程相关信息-u userlist  指定有效的用户ID或名称-U userlist 指定真正用户ID或名称-g gid 或groupname 指定有效的gid或组名称-G gid或groupname 指定真正的gid 或组名称-p pid 显示pid的进程--ppid  

PS Output Properties

VSZ: Virtual memory SiZe,虚拟内存集,线性内存 RSS: ReSident Size, 常驻内存集 STAT:进程状态  R:running  S: interruptable sleeping D: uninterruptablesleeping T: stopped  Z: zombie   +: 前台进程   l: 多线程进程  L:内存分页并带锁  N:低优先级进程   <: 高优先级进程   

Ps

ni: nice值 pri: priority 优先级 psr: processor  

PS Example

The PS sample queries all processes you own: Ps-x Displays the process for specifying a user name (RUID) or user id: Ps-fu Apache PS-FU 48 Displays the process for specifying a user name (EUID) or user id: Ps-fu Wang Ps-fu 1000 view with root user rights Each process running (actual and valid ID): ps-u root-u Root Lists all processes owned by a group (actual group Id:rgid or name): PS-FG nginx Lists all the processes owned by the valid group name (or session): PS-FG MYSQLPS-FG 27 by Process ID to show the processes that belong to: PS-FP 1234 shows all processes under its parent process ID, such as showing all processes with a parent process of 1154: ps-f--ppid 1234 Displays multiple processes that specify PID: PS-FP 1204,1239,1263 to display the owning process by TTY: ps-ft pst/0 shows how processes in the system are linked to each other in a process tree: Ps-e--forest Displays the specified process in the process tree ps-f--forest-c sshd ps-ef--fore St | Grep-v grep | grep sshd to display all threads of a process, the LWP (lightweight process) and the NLWP (lightweight processes) column are displayed: ps-fl-c nginx to list all format specifiers: PS L view process pid,ppid, user name and command: Ps-eo pid,ppid , User,cmd custom Format displays the file system group, NI value start time, and process time: Ps-p 1234-o Pid,ppid,fgroup,ni,lstart,etime uses its PID to find the process name: Ps-p 1244-o comm= to name Select a specific process to display all its child processes Ps-c Sshd,bash Find all of the PID of the specified process name, this parameter is useful when writing a script that needs to read the PID from the STD output or file: Ps-c httpd,sshd-o pid= checks the execution time of a process PS- EO Comm,etime,user | grep Nginx finds the process that consumes the most memory and CPU: Ps-eo pid,ppid,cmd,%mem,%cpu--sort=-%mem | Headps-eo PID,PPID,CMD,%MEM,%CPU--sort=-%cpu | Head Display security information: PS-EM PS--context Use the following command to display security information in a user-defined format. Ps-eo Euser,ruser,suser,fuser,f,comm,label uses the watch utility to perform repetitive outputs to enable real-time monitoring of the process, such as the following command, which displays the monitoring Watch-n 1 ' Ps-eo pid,ppid per second, CMD,%MEM,%CPU--sort=-%mem | Head

Process priority

进程优先级调整:    静态优先级:100-139    进程默认启动时的nice值为0,优先级为120     只有根用户才能降低nice值(提高优先性)nice命令:    nice [OPTION] [COMMAND [ARG]...] renice命令:     renice [-n] priority pid... 查看:     

Search process

最灵活:ps 选项 | 其它命令按预定义的模式:pgrep     pgrep [options] pattern      -u uid: effective user,生效者     -U uid: real user,真正发起运行命令者     -t terminal: 与指定终端相关的进程     -l: 显示进程名      -a: 显示完整格式的进程名    -P pid: 显示指定进程的子进程    按确切的程序名称:/sbin/pidof      

System Tools

uptime显示当前时间,系统已启动的时间、当前上线人数,系统平均负载(1、5、10分 钟的平均负载,一般不会超过1)系统平均负载:  

Process management Tools

top:有许多内置命令: 排序:       P:以占据的CPU百分比,%CPU      M:占据内存百分比,%MEM    T:累积占据CPU时长,TIME+    首部信息显示:      uptime信息:l命令     tasks及cpu信息:t命令    cpu分别显示:1 (数字)    memory信息:m命令       退出命令:q     修改刷新时间间隔:s      终止指定进程:k     保存文件:W top命令 栏位信息简介us:用户空间sy:内核空间ni:调整nice时间id:空闲wa:等待IO时间 hi:硬中断 si:软中断(模式切换)st:虚拟机偷走的时间 进程管理工具 选项:  -d #: 指定刷新时间间隔,默认为3秒    -b: 全部显示所有进程    -n #: 刷新多少次后退出 htop命令:EPEL源     选项: -d #: 指定延迟时间;-u UserName: 仅显示指定用户的进程 -s COLUME: 以指定字段进行排序       子命令: s: 跟踪选定进程的系统调用l: 显示选定进程打开的文件列表 a:将选定的进程绑定至某指定CPU核心  t: 显示进程树

Memory space

内存空间使用状态:free [OPTION]     -b  以字节为单位     -m  以MB为单位      -g  以GB为单位    -h  易读格式    -o  不显示-/+buffers/cache行      -t   显示RAM + swap的总和     -s  n  刷新间隔为n秒     -c  n  刷新n次后即退出   

Memory Tools

 vmstat命令:虚拟内存信息 vmstat [options] [delay [count]]  vmstat 2 5   procs:     r:可运行(正运行或等待运行)进程的个数,和核心数有关    b:处于不可中断睡眠态的进程个数(被阻塞的队列的长度) memory:    swpd: 交换内存的使用总量     free:空闲物理内存总量    buffer:用于buffer的内存总量     cache:用于cache的内存总量 swap:     si:从磁盘交换进内存的数据速率(kb/s)     so:从内存交换至磁盘的数据速率(kb/s) io:     bi:从块设备读入数据到系统的速率(kb/s)     bo: 保存数据至块设备的速率  system:     in: interrupts  中断速率,包括时钟     cs: context switch  进程切换速率  cpu:      us:Time spent running non-kernel code      sy: Time spent running kernel code      id: Time spent idle. Linux 2.5.41前,包括IO-wait time.      wa: Time spent waiting for IO.  2.5.41前,包括in idle.      st: Time stolen from a virtual machine.  2.6.11前, unknown.      选项:    -s: 显示内存的统计数据iostat:统计CPU和设备IO信息示例:iostat 1 10pmap命令:进程对应的内存映射 pmap [options] pid [...]-x: 显示详细格式的信息  示例:pmap 1 另外一种实现:  cat /proc/PID/maps   

System Monitoring Tools

Glances command: Epel source glances [-BDEHMNRSVYZ1] [-B bind] [-C Server] [-C conffile] [-P port] [-p password] [--password] [t refres  h] [-F file] [-o output] built-in command: a sort processes automatically l Show/hide logs c Sort processes by CPU% b           Bytes or bits for network I/O m sort processes by mem% W Delete warning logs p Sort processes by name X Delete warning and critical logsi Sort processes by I/O rate 1 Global CPU or per-cpu stats d show/hide Disk I  /o stats H show/hide This help screen f show/hide file system stats T View network I/O as combination n Show/hide Network stats u View Cumulative network I/O s show/hide sensors stats Q Quit (ESC and Ctrl -C also work) Y show/hide hddtemp stats common options:-B: Display nic data rate in bytes D: Turn off disk I/O module-f/path/to/somefile: Set input file Location-o {html| CSV}: Output format-M: Disable Mount module-N: Disable the network module-T #: Delay Interval-1: Each CPU related data is displayed separately in the C/S mode run glances command server mode glances-s-B ipaddr ipaddr: Refers to Which address client-side mode the listener listens to: glances-C ipaddr ipaddr: server-side address to be connected dstat command: System resource statistics, instead of Vmstat,iostat Dstat [-AFV] [Options ...] [Delay [Count]]-C: Display CPU-related information-C #,#,..., total-d: Display disk related information-D total,sda,sdb,...-G: Show page related statistics-m: Display memory related statistics-N: Show Display network related statistics-P: Show process related statistics-r: Display statistics related to IO request-S: Show swapped related statistics--tcp--udp--unix--raw--socket--IPC--TOP-CP   U: Show CPU-intensive process--top-io: show most IO-intensive process--top-mem: show the most memory-intensive process--top-latency: show the process with the most latency

Iotop

iotop命令是一个用来监视磁盘I/O使用状况的top类工具iotop具有与top相似的UI,其 中包括PID、用户、I/O、进程等相关信息,可查看每个进程是如何使用IO  iotop输出 第一行:Read和Write速率总计  第二行:实际的Read和Write速率 第三行:参数如下: 线程ID(按p切换为进程ID) 优先级 用户 磁盘读速率  磁盘写速率 swap交换百分比 IO等待所占的百分比 线程/进程命令 iotop常用参数 -o, --only只显示正在产生I/O的进程或线程,除了传参,可以在运行过程中按o 生效-b, --batch非交互模式,一般用来记录日志 -n NUM, --iter=NUM设置监测的次数,默认无限。在非交互模式下很有用 -d SEC, --delay=SEC设置每次监测的间隔,默认1秒,接受非×××数据例如1.1 -p PID, --pid=PID指定监测的进程/线程 -u USER, --user=USER指定监测某个用户产生的I/O -P, --processes仅显示进程,默认iotop显示所有线程-a, --accumulated显示累积的I/O,而不是带宽 -k, --kilobytes使用kB单位,而不是对人友好的单位。在非交互模式下,脚本 编程有用 iotop常用参数和快捷键 -t, --time 加上时间戳,非交互非模式-q, --quiet 禁止头几行,非交互模式,有三种指定方式     -q 只在第一次监测时显示列名     -qq 永远不显示列名     -qqq 永远不显示I/O汇总 交互按键    left和right方向键:改变排序    r:反向排序    o:切换至选项--only    p:切换至--processes选项    a:切换至--accumulated选项    q:退出    i:改变线程的优先级  

Lsof

 Lsof:list open files View the tools for the current system files. In the Linux environment, all files, the user can not only access the general data through the file, but also access to network connectivity and hardware such as Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) sockets, etc., the system in the background for the application assigned a file Descriptor command parameter-A: list the hit     The process in which the file exists-c< process name;: Lists files opened by the specified process-G: List GID Process details-d< file number;: Lists the processes that occupy the file number +d< directory;: List files opened in directory +d< Directory: Recursively lists the files opened under directory-n< directory;: Lists the file-i< conditions for NFS;: Lists the eligible processes (4, 6, protocol, port, @ip)-p< process number;: List Specify the file opened by the process number-U: List UID number process details-H: Displays help information-V: Displays version information.                  Process management view processes that are initiated by the logged-on user instead of the system lsof/dev/pts1 specify the process number, and you can view the files that the process opens Lsof-p 9527 file management view files opened by the specified program Lsof-c httpd view files opened by specified users lsof-u root | More view files opened under the specified directory lsof +d/var/log/lsof +d/var/log/parameter +d to recursively list files opened under directory, Parameters +d for listing directory Open File Network management view all network Connections lsof-i–n lsof [email protected] through the parameters-I view network connections, including connected IP, ports, and some services such as connection conditions such as: s SHD and so on. You can also view port connectivity by specifying IP to view the network connectivity of the IP lsof-i: 80-n through the Parameters-I: port to see the port occupancy, the-I parameter and view protocol, IP connectivity, etc. view the network that the specified process opensConnection lsof-i–n-a-P 9527 Parameters-I,-A,-p, etc.,-I view network connectivity,-a view the processes that exist,-p Specify the process to view the network connection for the specified state lsof-n-p-i tcp-s Tcp:establi Shed-n:no host names,-p:no port names,-i TCP specified protocol,-S specify protocol status through multiple parameters can clearly view network connectivity, protocol connectivity, etc. recover deleted files Lsof |grep/var/log /messages rm-f/var/log/messages lsof |grep/var/log/messages cat/proc/653/fd/6 CAT/PROC/653/FD/6 >/va  R/log/messages

Process management Tools

 kill命令:  向进程发送控制信号,以实现对进程管理,每个信号对应一个数字,信号名称以SIG开头 (可省略),不区分大小写 显示当前系统可用信号: kill –l,trap -l  常用信号:man 7 signal  1) SIGHUP: 无须关闭进程而让其重读配置文件  2) SIGINT: 中止正在运行的进程;相当于Ctrl+c  3) SIGQUIT:相当于ctrl+\  9) SIGKILL: 强制杀死正在运行的进程  15) SIGTERM:终止正在运行的进程   18) SIGCONT:继续运行  19) SIGSTOP:后台休眠  指定信号的方法: (1) 信号的数字标识:1, 2, 9   (2) 信号完整名称:SIGHUP (3) 信号的简写名称:HUP 进程管理工具 按PID:kill [-SIGNAL]  pid …     kill –n SIGNAL pid;kill –s SIGNAL pid按名称:killall [-SIGNAL]  comm… 按模式:pkill [options] pattern      -SIGNAL     -u uid: effective user,生效者     -U uid: real user,真正发起运行命令者      -t terminal: 与指定终端相关的进程     -l: 显示进程名(pgrep可用)     -a: 显示完整格式的进程名(pgrep可用)  -P pid: 显示指定进程的子进程   

Job Management

 Linux的作业控制      前台作业:通过终端启动,且启动后一直占据终端    后台作业:可通过终端启动,但启动后即转入后台运行(释放终端) 让作业运行于后台    (1) 运行中的作业: Ctrl+z    (2) 尚未启动的作业:    COMMAND & 后台作业虽然被送往后台运行,但其依然与终端相关;退出终端,将关闭后台作业。如果希望 送往后台后,剥离与终端的关系     nohup COMMAND &>/dev/null  &      screen;COMMAND 查看当前终端所有作业:jobs 作业控制:     fg [[%]JOB_NUM]:把指定的后台作业调回前台      bg [[%]JOB_NUM]:让送往后台的作业在后台继续运行     kill [%JOB_NUM]: 终止指定的作业  

Run in parallel

    并行运行 同时运行多个进程,提高效率方法1         vi all.sh       f1.sh&       f2.sh&       f3.sh& 方法2      (./f1.sh&);(./f2.sh&);(./f3.sh&) 方法3         

Task Scheduler

Linux任务计划,周期性任务执行未来的每一段时间点执行一次任务    at    batch :系统自行选择空闲时间执行此处指定的任务周期性运行某任务    cron

At task

  包:at  at命令:  常用选项:        -V 显示版本信息        -l 列出指定队列中等带运行的作业,相当于atq        -d 删除指定的作业,相当于atrm        -c 查看具体作业任务        -f /path/file 指定的文件中读取任务注意:作业执行命令的结果的标准输出和错误以邮件通知给相关用户TIME :定义出什么时间进行at这项任务的时间    HH:MM [YYYY-mm-dd]    noon, midnight, teatime(4pm)tomorrownow+#{minutes,hours,days, OR weeks}    他的定时任务放在了  /var/spool/at下   例:at 11:27at> wall "dang"        at> <EOT>job 4 at 2018-08-29 11:27  退出时按Ctrl+d例:at now+1minutes  [这是一分钟后执行]at> wall "dang"        at> <EOT>job 4 at 2018-08-29 11:27

At time format

    HH:MM 02:00在今日的 HH:MM 进行,若该时刻已过,则明天此时执行任务HH:MM YYYY-MM-DD 02:00 2016-09-20 规定在某年某月的某一天的特殊时刻进行该项任务HH:MM[am|pm] [Month] [Date] 04pm March 17 17:20 tomorrowHH:MM[am|pm] + number [minutes|hours|days|weeks] 在某个时间点再加几个时间后才进行该项任务 now + 5 min 02pm + 3 days  

At task

执行方式: 1)交互式 2)输入重定向 3)at –f 文件依赖与atd服务,需要启动才能实现at任务at队列存放在/var/spool/at目录中/etc/at.{allow,deny}控制用户是否能执行at任务 白名单:/etc/at.allow【默认没有手工键】 默认不存在,只有该文件中的用户才能执行at命令    例:把dang 加到这个文件中,他就有at权限了 黑名单:/etc/at.deny【默认有】        例:把dang 加到这个文件中,他就没有at权限了   默认存在,拒绝该文件中用户执行at命令,而没有在at.deny 文件中的使用者则可执行 如果两个文件都不存在,只有 root 可以执行 at 命令 如果两个文件都存在,白名单有限期更高

Recurring Task Schedule

    周期性任务计划:cron相关的程序包:cronie: 主程序包,提供crond守护进程及相关辅助工具cronie-anacron:cronie的补充程序,用于监控cronie任务执行状况,如cronie中的任务在过去该运行的时间点未能正常运行,则anacron会随后启动一次此任务crontabs:包含CentOS提供系统维护任务

Scheduled Tasks

    Make sure the Crond daemon is running: the CentOS 7:systemctl status Crondcentos 6:service crond status is scheduled to be carried out on a recurring mission to Crond, The System cron task runs automatically to a specified time: System maintenance Job/etc/crontab User Cron task: crontab command log:/var/log/cron tail-f/var/log/cron can track/var/log/cron Log Schedule Task System Cron task:/etc/crontab comment lines begin with # See man 5 crontab# Example of Job definition:#.----------------minute (0-59) # |  .-------------Hour (0-23) # | |.----------DAY of Month (1-31) # | | |.-------month (1-12) OR jan,feb,mar,apr ... # | | | | |----DAY of Week (0-6) (sunday=0 or 7) or sun,mon,tue,wed,thu,fri,sat# | | | | |# * * * * * user-name command To be executed example: Run the echo command at 9:10 * * * wang/bin/echo "howdy!" Scheduled task time notation:? (1) A value within a valid value range for a given point in time for a particular value? (2) * All values in the range of valid values at a given point in time represent "every ..."? (3) discrete value #,#,#? (4) Continuous value #-#? (5) on the specified time range, define the step/#: #即为步长时间格式 @reboot run once after reboot "What to do at the next reboot:" @yearly 0 0 1 1 * @annually 0 0 1 1 * @monthly 0 0 1 * * @weekly 0 0 * * 0@daily 0 0 * * * @hourly 0 * * * * Example: every 3 hours echo and Wall command 0 */3 * * * centos/bin/echo "howdy";/usr/bin /wall "Welcome to Magedu! " Planning tasks? System's Scheduled Tasks:/etc/crontab profile/etc/cron.d/Profile Two can: example: vim/etc/cron.d/dang[then write the configuration file in]/etc/cron.hourly/script/etc/ cron.daily/Script/etc/cron.weekly/Script/etc/cron.monthly/script

Anacron system

运行计算机关机时cron不运行的任务,centos6以后取消anacron服务,由crond服务管理对笔记本电脑,台式机,工作站,偶尔要关机的服务器及其他不一直开机的系统很有用也很重要配置文件:/etc/anacrontab,负责执行/etc/ cron.daily /etc/cron.weekly/etc/cron.monthly中系统任务? 字段1:如果在这些日子里没有运行这些任务……? 字段2:在重新引导后等待这么多分钟后运行它? 字段3:任务识别器,在日志文件中标识? 字段4:要执行的任务由/etc/cron.hourly/0anacron执行当执行任务时,更新/var/spool/anacron/cron.daily 文件的时间戳  

Manage Temporary files

    CentOS6使用/etc/cron.daily/tmpwatch定时清除临时文件CentOS7使用systemd-tmpfiles-setup服务实现配置文件:/etc/tmpfiles.d/*.conf/run/tmpfiles.d/*.conf/usr/lib/tmpfiles/*.conf/usr/lib/tmpfiles.d/tmp.confd /tmp 1777 root root 10dd /var/tmp 1777 root root 30d命令:systemd-tmpfiles –clean|remove|create configfile  

User Scheduled Tasks

    crontab命令定义每个用户都有专用的cron任务文件:/var/spool/cron/USERNAMEcrontab命令:crontab [-u user] [-l | -r | -e] [-i]-l: 列出所有任务-e: 编辑任务-r: 移除所有任务-i:同-r一同使用,以交互式模式移除指定任务  【就是提示一下】-u user: 仅root可运行,指定用户管理cron任务控制用户执行计划任务:/etc/cron.{allow,deny}  【allow 白名单  ,deny 黑名单  用法和at的一样】     cd /var/spool/cron/   定时任务写完以后 会放在一个目录下 , root能看   root查看用户的定时任务  roo -i -u dang[查看dang 用户的定时任务]     crontab -e  要想带颜色 写入文件 vim /etc/profile.d/jiu.sh   :内容为export EDITOR=vim

Process and Scheduled Tasks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.