AIX command collection 6 (automatic job command execution)

Source: Internet
Author: User
Tags echo command

6.1 control the frontend and backend job commands
Jobs indicates viewing the currently paused job or running job in the background
FG % 1 indicates converting background Job 1 to foreground running
BG % 1 indicates that the paused Task 1 will continue running in the background
When a process or job is running on the foreground, you can use Ctrl + Z to pause it.
Kill % 1 indicates killing job 1
Nohug Command [arg...] [&] indicates to run a command that will not be hung up.
Command [arg...] indicates the running command and related parameters.
& Indicates running in the background
Nohug find/-name myprg-Print & indicates executing a search job in the background

6.2 use of the at command
At [-c |-k |-S |-Q queue] [-M] [-F file] {-t date | time [Day] [increament]}
-C indicates that CSH is used to execute the job.
-K indicates that KSh is used to execute a job.
-S indicates that bsh (Bourne shell) is used to execute the job.
-Q queue: Put the job in the specified queue
-M indicates that the information after successful command execution is sent to the login user by email
-F file: Replace the standard input with a file name.
-T date | time [Day] [increament] indicates the running time of the specified job.
Date Format: [[CC] YY] mmddhhmm. [ss] CC indicates the century, YY indicates the last two digits of the Year, MM indicates the month, DD indicates the day of the month, that is, number, HH indicates the time,
MM indicates the number of minutes and SS indicates the number of seconds.
The time format is a number + suffix (can be am, PM, Zulu)/number. For example, at 0820 indicates 08:20, at 0820 indicates 08:20.
The format of day is: month + day number/day of a week (day of the week), such as at 7 pm July 26
The increament format is + n units, indicating the number of additional units, such as at now + 38 days.

At time
Command1
Command2
....
CTRL + d end command input
The above indicates the command to be executed at a certain time
You can also use pipelines.
Echo command | at time
You can also specify the execution File
At-F file time

Show and delete at jobs
At-L [-O] [job... |-Q queue]
-L indicates that the created job is displayed.
-O: displays created jobs in the order of job schedules.
Job indicates the job number.
-Q queue: name of the job team Column
At-N [user] indicates the number of files in the queue.

At-R [-F] [-I] job ....
At-R [-F] [-I]-u user
-R indicates deleting existing jobs in the current system.
-F indicates that the fact deletion verification is prohibited.
-I indicates interactive deletion.
Job indicates the job number.
-U user indicates to delete all jobs of the user. Only the root user has this permission. Other users can only delete all their jobs.
You can also use the atrm command to delete a specified job.
ATQ [-c |-N] [user...] indicates the Job Queue that the current user is waiting to execute.
-C: sort the Job Queue according to the time when the AT command is executed.
-N indicates that only the job number in the queue is displayed.
Only user jobs are displayed.
The files that control the use of the AT/batch command are:/var/adm/cron/at. allow and/var/adm/cron/at. deny.
If the at. allow file exists, only the users in the file have the right to execute the AT command.
If the at. deny file exists, all users that do not appear in the file have the right to execute the AT command.
If the at. allow and at. deny files do not exist, only the root user has the right to execute the AT command.

6.3. Batch command
The batch command is to call the at-B-M now command to submit a batch of jobs to the system. The system puts the Jobs submitted in a queue and checks the system load and the average load is lower than a certain
Run the job after the pre-determined value
Batch command1 command2... Ctrl + d end

6.4. crontab provides periodical Automatic Command Execution
Check whether the cron process exists
PS-Ef | grep Cron
The cron process is a background process started by the INIT process. If this process is not available, check whether the following records exist in the/etc/inittab file:
Cron: 23456789: respawn:/usr/sbin/cron
If no, use the mkitab command or the VI command to add this record, then run telinit-Q to start the cron process, and telinit-Q is also the command to restart the cron process.
The cron process reads the crontab file created by the cron process for each user. The file is named after the user name and is mainly stored in the/var/spool/cron/crontabs directory.
The crontab file record format is:
Minute Hour day_of_month month weekday command
Minute indicates minute, range: 0-59
Hour indicates the hour, ranging from 0 to 23
Day_of_month indicates the number of months in the range of 1-31.
Month indicates the month in the range of 1-12.
Weekday indicates the day of the week, ranging from 0 to 6, and 0 indicates Sunday.
Command indicates the command or shell script to be executed

Add or modify a cron job
You can use the VI command to directly modify the files in the/var/spool/cron/crontabs directory.
Crontab [-E |-L |-r |-v | file]
-E Indicates editing the crontab file of the current user.
-L: displays the contents of the crontab file.
-R indicates deleting the user's crontab file
-V indicates the time when the user cron job is submitted.
File: copy the file to the/var/spool/cron/crontabs directory, and use the current user name or overwrite the existing user name file.

Files in the/usr/ADM/cron directory record cron logs and settings of power usage.

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.