Tag: name specifies modify periodic secondary daemon static direct stop
First, the process of viewing and management
1. View
A, PS static view
Format: PS [options]
Options:
A: terminal-related
X: Terminal-Independent
U: User-centric
-e: Show All Processes
-F: Display full format program information
-L: Show full columns
-H: Show process-related information in process-level format
~]# PS aux USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND vsz:virtual memory SiZe, virtual Memory set Rss:resident Size, resident memory set STAT: Process status r:running s:interruptable sleeping d:uninterruptable Sleeping t:stopped Z:zombie +: Foreground process L: Multithreaded process N: low-priority process <: high-priority process s:s Ession leader B, top dynamic view has many built-in commands: Sort: P: Percentage of CPU occupied; M: Percentage of memory occupied; T: Cumulative Occupy CPU time; header information: Uptime information: l command tasks and CPU information: T command CPU display: 1 (digital) memory information: M command exit command: Q Modify Refresh interval: s terminates the specified process: K option:-D #: Specifies the refresh interval, which defaults to 3 seconds;-B: Batch mode;-N #: How many batches are displayed; C, pstree View process tree format: pstree [options] Option:-A: Display finished Full Information-u: Display user name-P: Show process ID number D, pgrep view process format according to specified information: pgrep Specifies information such as pgrep-l-u user name-T terminal-L: Show process name -u: Specify user-T: Specify terminal2, the process of the start a, manually start the foreground start: directly in the terminal to run the program can be started in the background: the original execution of the program in the foreground to run in the background after running the program plus & before and after the operation: Ctrl + Z: The running process into the background and stop Execute jobs: View background Process list FG [list ordinal]: Resume background stop process restore foreground run B, schedule start one-time scheduled task: At recurring Scheduled tasks: CRONTAB3, End process Ctrl+ckill PID number Kill -9 PID number//Caution with Killall process name killall-9 process name//caution with Pkill-u user name-T terminal//end the process of the specified user on the specified terminal pkill-9-u user name-T end End//Use caution
Ii. Scheduled Tasks
1, disposable at
Make sure: ATD service is running
Format: at [hh:mm] [YYYY-MM-DD]//Press CTRL+D submit
Example: #at 21:30
At>shutdown-h now
ATQ//View a list of tasks that have not yet been performed
ATRM N//delete specified task not yet performed
2. Periodic
Recurring Task Scheduler: Cron
Related packages:
Cronie: The main package, provides the Crond daemon and related auxiliary tools;
Cronie-anacron:cronie to monitor the execution of Cronie tasks, such as when a task in Cronie has not run correctly in the past, the Anacron will then initiate this task;
Crontabs: Includes centos to provide system maintenance tasks;
Ensure Crond daemon is running: CentOS 7:systemctl status Crond ... running The CentOS 6:service crond status is scheduled to be performed on a recurring task to Crond, which is implemented to the point of operation. System Cron Task: System maintenance Job/etc/crontab User Cron Task: crontab command System cron Task # 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 for example: 9:10 run the echo command; * * * * GENTOO/BI N/echo "howdy!" Time notation: (1) A specific value, a value within a valid value range for a given point in time, and (2) * All of the valid values in a given point-in-time range Value: "Every ..."; (3) Discrete value:, #,#,# (4) consecutive values:-#-# (5) in Specify the time range, define the step:/#: #即为步长 Example: Echo command every 3 hours; 0 */3 * * * gentoo/bin/echo "howdy!" User cron:crontab command definition, each user has a dedicated cron task file:/var/spool/cron/username crontab command: CRO Ntab [-u user] [-l |-r |-e] [-i]-L: List all Tasks;-e: Edit task;-r: Remove the Have a task;-I: Use with-R to selectively remove specified tasks in interactive mode;-U user: Only root can run, manage cron tasks for designated users; Note: Run Results are notified to relevant users by email; (1) command >/dev/null (2) command &>/dev/null for cron tasks,% has special If you want to use% in the command, you need to escape, but if you place the% in single quotation marks, you can not escape;
Viewing and managing Linux processes