如何向 atd 指定精确日期

如何向 atd 指定精确日期

我在这里找到了一些例子:http://www.thegeekstuff.com/2010/06/at-atq-atrm-batch-command-examples

但是我怎样才能在工作中创建包含分钟、秒甚至年的特定时间,比如2018-01-15 08:00:00?输入日期/时间的格式是什么?

答案1

一个具体的例子:

$ at 4pm + 5 days
warning: commands will be executed using /bin/sh
at> true
at> <EOT>  # ctrl+d
job 1 at Thu May  4 16:00:00 2023

具有特定日期/时间:

$ at 4pm 050423 
warning: commands will be executed using /bin/sh
at> true
at> <EOT>
job 3 at Thu May  4 16:00:00 2023

答案2

您是否尝试过阅读手册页?

男子在:

   At allows fairly complex time  specifications,  extending  the  POSIX.2
   standard.   It  accepts  times of the form HH:MM to run a job at a spe‐
   cific time of day.  (If that time is already  past,  the  next  day  is
   assumed.)   You  may  also specify midnight, noon, or teatime (4pm) and
   you can have a time-of-day suffixed with AM or PM for  running  in  the
   morning or the evening.  You can also say what day the job will be run,
   by giving a date in the form month-name day with an optional  year,  or
   giving  a  date  of  the form MMDD[CC]YY, MM/DD/[CC]YY, DD.MM.[CC]YY or
   [CC]YY-MM-DD.  The specification of a date must follow  the  specifica‐
   tion  of  the  time  of  day.  You can also give times like now + count
   time-units, where the time-units can be minutes, hours, days, or  weeks
   and  you  can  tell  at to run the job today by suffixing the time with
   today and to run the job tomorrow by suffixing the time with tomorrow.

   For example, to run a job at 4pm three days from now, you would  do  at
   4pm  + 3 days, to run a job at 10:00am on July 31, you would do at 10am
   Jul 31 and to run a job at 1am tomorrow, you would do at 1am tomorrow.

   The  definition  of  the   time   specification   can   be   found   in
   /usr/share/doc/at/timespec.

相关内容