⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timedate.html

📁 Shall高级编程
💻 HTML
📖 第 1 页 / 共 2 页
字号:
CLASS="USERINPUT"><B>&#62;&#62; newfile</B></TT> (for ordinary	      files).</P></TD></TR></TABLE></DIV><DIVCLASS="TIP"><TABLECLASS="TIP"WIDTH="90%"BORDER="0"><TR><TDWIDTH="25"ALIGN="CENTER"VALIGN="TOP"><IMGSRC="common/tip.png"HSPACE="5"ALT="Tip"></TD><TDALIGN="LEFT"VALIGN="TOP"><P>Before doing a <AHREF="external.html#CPREF">cp -u</A>	      (<ICLASS="FIRSTTERM">copy/update</I>), use	      <BCLASS="COMMAND">touch</B> to update the time stamp of files	      you don't wish overwritten.</P><P>As an example, if the directory <TTCLASS="FILENAME">/home/bozo/tax_audit</TT> contains the	      files <TTCLASS="FILENAME">spreadsheet-051606.data</TT>,	      <TTCLASS="FILENAME">spreadsheet-051706.data</TT>, and	      <TTCLASS="FILENAME">spreadsheet-051806.data</TT>, then	      doing a <BCLASS="COMMAND">touch spreadsheet*.data</B>	      will protect these files from being overwritten	      by files with the same names during a	      <BCLASS="COMMAND">cp -u /home/bozo/financial_info/spreadsheet*data	      /home/bozo/tax_audit</B>.</P></TD></TR></TABLE></DIV></DD><DT><ANAME="ATREF"></A><BCLASS="COMMAND">at</B></DT><DD><P>The <BCLASS="COMMAND">at</B> job control command executes	      a given set of commands at a specified time. Superficially,	      it resembles <AHREF="system.html#CRONREF">cron</A>, however,	      <BCLASS="COMMAND">at</B> is chiefly useful for one-time execution	      of a command set.</P><P><TTCLASS="USERINPUT"><B>at 2pm January 15</B></TT> prompts for a set of	      commands to execute at that time. These commands should be	      shell-script compatible, since, for all practical	      purposes, the user is typing in an executable shell	      script a line at a time.	Input terminates with a <AHREF="special-chars.html#CTLDREF">Ctl-D</A>.</P><P>Using either the <TTCLASS="OPTION">-f</TT> option or input	      redirection (<SPANCLASS="TOKEN">&#60;</SPAN>), <BCLASS="COMMAND">at</B>	      reads a command list from a file. This file is an	      executable shell script, though it should, of course,	      be non-interactive. Particularly clever is including the	      <AHREF="extmisc.html#RUNPARTSREF">run-parts</A> command in	      the file to execute a different set of scripts.</P><P>	      <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="SCREEN"> <TTCLASS="PROMPT">bash$ </TT><TTCLASS="USERINPUT"><B>at 2:30 am Friday &#60; at-jobs.list</B></TT> <TTCLASS="COMPUTEROUTPUT">job 2 at 2000-10-27 02:30</TT> 	      </PRE></TD></TR></TABLE>	    </P></DD><DT><ANAME="BATCHREF"></A><BCLASS="COMMAND">batch</B></DT><DD><P>The <BCLASS="COMMAND">batch</B> job control command is similar to	      <BCLASS="COMMAND">at</B>, but it runs a command list when the system	      load drops below <TTCLASS="LITERAL">.8</TT>. Like	      <BCLASS="COMMAND">at</B>, it can read commands from a file with the	      <TTCLASS="OPTION">-f</TT> option.</P><P><ANAME="BATCHPROCREF"></A></P><TABLECLASS="SIDEBAR"BORDER="1"CELLPADDING="5"><TR><TD><DIVCLASS="SIDEBAR"><ANAME="AEN9868"></A><P>The concept of <ICLASS="FIRSTTERM">batch processing</I>              dates back to the era of mainframe computers. It means              running a set of commands without user intervention.</P></DIV></TD></TR></TABLE></DD><DT><ANAME="CALREF"></A><BCLASS="COMMAND">cal</B></DT><DD><P>Prints a neatly formatted monthly calendar to	      <TTCLASS="FILENAME">stdout</TT>. Will do current year or a large	      range of past and future years.</P></DD><DT><ANAME="SLEEPREF"></A><BCLASS="COMMAND">sleep</B></DT><DD><P>This is the shell equivalent of a <ICLASS="FIRSTTERM">wait	      loop</I>. It pauses for a specified number of	      seconds, doing nothing. It can be useful for timing or	      in processes running in the background, checking for	      a specific event every so often (polling), as in <AHREF="debugging.html#ONLINE">Example 29-6</A>.  <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING">   1&nbsp;sleep 3     # Pauses   2&nbsp;	      3 seconds.</PRE></TD></TR></TABLE>	    </P><DIVCLASS="NOTE"><TABLECLASS="NOTE"WIDTH="90%"BORDER="0"><TR><TDWIDTH="25"ALIGN="CENTER"VALIGN="TOP"><IMGSRC="common/note.png"HSPACE="5"ALT="Note"></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The <BCLASS="COMMAND">sleep</B> command defaults to	      seconds, but minute, hours, or days may also be specified.	      <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING">   1&nbsp;sleep 3 h   # Pauses 3 hours!</PRE></TD></TR></TABLE>            </P></TD></TR></TABLE></DIV><DIVCLASS="NOTE"><TABLECLASS="NOTE"WIDTH="90%"BORDER="0"><TR><TDWIDTH="25"ALIGN="CENTER"VALIGN="TOP"><IMGSRC="common/note.png"HSPACE="5"ALT="Note"></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The <AHREF="system.html#WATCHREF">watch</A> command may	      be a better choice than <BCLASS="COMMAND">sleep</B> for running	      commands at timed intervals.</P></TD></TR></TABLE></DIV></DD><DT><ANAME="USLEEPREF"></A><BCLASS="COMMAND">usleep</B></DT><DD><P><ICLASS="FIRSTTERM">Microsleep</I> (the	      <ICLASS="FIRSTTERM">u</I> may be read as the Greek	      <ICLASS="FIRSTTERM">mu</I>, or <ICLASS="FIRSTTERM">micro-</I>	      prefix). This is the same as <BCLASS="COMMAND">sleep</B>,	      above, but <SPANCLASS="QUOTE">"sleeps"</SPAN> in microsecond	      intervals. It can be used for fine-grained timing,	      or for polling an ongoing process at very frequent	      intervals.</P><P>  	      <TABLEBORDER="0"BGCOLOR="#E0E0E0"WIDTH="90%"><TR><TD><PRECLASS="PROGRAMLISTING">   1&nbsp;usleep 30     # Pauses 30 microseconds.</PRE></TD></TR></TABLE>	    </P><P>This command is part of the Red Hat	    <ICLASS="FIRSTTERM">initscripts / rc-scripts</I> package.</P><DIVCLASS="CAUTION"><TABLECLASS="CAUTION"WIDTH="90%"BORDER="0"><TR><TDWIDTH="25"ALIGN="CENTER"VALIGN="TOP"><IMGSRC="common/caution.png"HSPACE="5"ALT="Caution"></TD><TDALIGN="LEFT"VALIGN="TOP"><P>The <BCLASS="COMMAND">usleep</B> command does not	      provide particularly accurate timing, and is therefore	      unsuitable for critical timing loops.</P></TD></TR></TABLE></DIV></DD><DT><ANAME="HWCLOCKREF"></A><BCLASS="COMMAND">hwclock</B>, <ANAME="CLOCKREF"></A><BCLASS="COMMAND">clock</B></DT><DD><P>The <BCLASS="COMMAND">hwclock</B> command accesses or	      adjusts the machine's hardware clock. Some options	      require <ICLASS="FIRSTTERM">root</I> privileges. The	      <TTCLASS="FILENAME">/etc/rc.d/rc.sysinit</TT> startup file	      uses <BCLASS="COMMAND">hwclock</B> to set the system time	      from the hardware clock at bootup.</P><P>The <BCLASS="COMMAND">clock</B> command is a synonym for	      <BCLASS="COMMAND">hwclock</B>.</P></DD></DL></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="moreadv.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="index.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="textproc.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">Complex Commands</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="external.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Text Processing Commands</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -