How do Linux systems use the at/crontab directive?

  

The at command in the Linux system can be executed periodically, while the crontab command is executed cyclically, so both commands can control the running time of the program. Here's how to use the at/crontab command on Linux systems?

at command to be executed, as long as at the time, press enter, and then enter the command to be executed, the end of the pressing ctrl + d can be scheduled at a schedule.

The time format of at can be 1 digit (specified hour), 2 digits (specified hour), 4 digits (specified hour and minute), and the middle and the minute can also be used: Separate, such as 03 :45. In addition, you can add am, pm to specify the last afternoon, otherwise at will treat the time as a 24-hour system, such as 05:25pm. In POSIX, there are a few other special times:

Time-time

The range of numbers is [00,59].

midnight = 12:00 am (00:00)

noon = 12:00 pm

now = Specify the time to execute at

Date- Date

The number used in the year is AD, which must be 4 digits.

When you specify the month and week, the word used depends on the "month" and "week" names listed in the LC_TIME environment variable or their abbreviation.

The date must match the month specified.

today = today

tomorrow = tomorrow

increase-increment

can use words such as minutes, hours, days, weeks, months, or years When using, start with a + sign.

Use the commands executed by the at command, the environment variables used, the working directory, the mask created by the file, and so on. When the scheduled command is actually executed, these variables are the same as when the at command is executed.

at Execute Permission Control File:

/usr/lib/cron/at.allow

/usr/lib/cron/at.deny

Example:

at 6pm

at moon

at today

at 02:00am

at 18:00

at 18:00

at 6pm today + 1 week is equivalent to at 6pm today next week

at 6pm Jan 2 , 2005

at 6pm mon

at now

at the time the command is to be executed, it will be executed until the next time, for example, it is specified at 6:00 tonight, but now it is 7:00. The order will be executed at 6:00 tomorrow evening.

To delete a scheduled job, use at -r at-job-id

Under gentoo, the default is no at program, you must first install the following command Only:

emerge -av at

/etc/init.d/atd start

and the timespec of the directive is placed in /usr/share/doc/at-XX .XX/timespec.gz in the documentation.

The above is how the Linux system uses the at/crontab directive. This article focuses more on the at command. The use of crontab is similar to at.

Copyright © Windows knowledge All Rights Reserved