<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: &amp;quot;date&amp;quot; command in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483593#M799005</link>
    <description>Using the -u switch to the date command indicates that you want the date for UTC as opposed to your local TZ. Drop the -u switch from the date command.</description>
    <pubDate>Wed, 17 Jan 2001 15:18:54 GMT</pubDate>
    <dc:creator>Rick Garland</dc:creator>
    <dc:date>2001-01-17T15:18:54Z</dc:date>
    <item>
      <title>"date" command in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483588#M799000</link>
      <description>Hi!&lt;BR /&gt;I used the following two lines to generate a filename for daily export dump file.&lt;BR /&gt;&lt;BR /&gt;seqid=`date -u +%m%d`&lt;BR /&gt;filename=exp_$seqid.dmp&lt;BR /&gt;&lt;BR /&gt;However, the number i got from "date" was&lt;BR /&gt;always one day earlier than the system exact day. The output of "ls -l" is like&lt;BR /&gt;-rw-r--r--   1 oracle     oinstall   7933952 Jan  8 05:50 exp_0107.dmp&lt;BR /&gt;-rw-r--r--   1 oracle     oinstall   7968768 Jan  9 05:50 exp_0108.dmp&lt;BR /&gt;-rw-r--r--   1 oracle     oinstall   8438784 Jan 10 05:50 exp_0109.dmp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And the wired thing is, if i run &lt;BR /&gt;date -u +%m%d&lt;BR /&gt;at the shell prompt now, i got the expected number "0117" as for today(Wed Jan 17 11:25:27 EAT 2001).&lt;BR /&gt;What's wrong here?&lt;BR /&gt;&lt;BR /&gt;Please help.&lt;BR /&gt;&lt;BR /&gt;Jessica</description>
      <pubDate>Wed, 17 Jan 2001 03:20:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483588#M799000</guid>
      <dc:creator>Jessica Chou</dc:creator>
      <dc:date>2001-01-17T03:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: "date" command in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483589#M799001</link>
      <description>I think the date you are generting is beore taking the dump. So if its before midnight, you will get the previous days date.&lt;BR /&gt; ls command lists the date/time when the dump file was last updated. Which is 0500 hours of the next day. If this is true then the script is behaving as expected. If you wish to update the dte when the dump files actually complete, just rename the file using the same script after the dump is created.&lt;BR /&gt;Hope it helps...&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jan 2001 03:32:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483589#M799001</guid>
      <dc:creator>Vinit Adya</dc:creator>
      <dc:date>2001-01-17T03:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: "date" command in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483590#M799002</link>
      <description>Hi Jessica,&lt;BR /&gt;&lt;BR /&gt;As Vinit told you, there is a great chance that your 'date' command runs before midnight and that the dump finishes at 05 AM the next day.&lt;BR /&gt;&lt;BR /&gt;You could start your dump using a temp file, and once finished move (rename) your temp file to the real name using your 'date' construct, like in:&lt;BR /&gt;mv tmp_file exp_`date -u +%m%d`.dmp &lt;BR /&gt;&lt;BR /&gt;This would ensure that the file name is showing the date you want, i.e. the end_of_dump date.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Jan 2001 07:02:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483590#M799002</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-17T07:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: "date" command in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483591#M799003</link>
      <description>Hi,&lt;BR /&gt;  thanks for your suggestion. I will try it.&lt;BR /&gt;(use a temp name, then rename it.)&lt;BR /&gt;  However, I didn't run "date -u +%m%d" before midnight.  "date" and Oracle's "exp" command&lt;BR /&gt;were included in the same script which then triggered by a crontab that set as:&lt;BR /&gt;50 5 * * 1-5 /mypath/my_dump.sh 2&amp;gt;&amp;gt; /mypath/dump_err.log&lt;BR /&gt;&lt;BR /&gt;In my_dump.sh, it has&lt;BR /&gt;# Oracle environment variables. (skipped)&lt;BR /&gt;# ....&lt;BR /&gt;seqid=`date -u +%m%d`&lt;BR /&gt;/oraclehome/bin/exp USERID=system/manager FULL=Y INCTYPE=incremental DIRECT=Y FILE=/BACKUP/exp_$seqid.dmp LOG=/mypath/exp_i.log&lt;BR /&gt;&lt;BR /&gt;#####&lt;BR /&gt;&lt;BR /&gt;Jessica</description>
      <pubDate>Wed, 17 Jan 2001 08:43:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483591#M799003</guid>
      <dc:creator>Jessica Chou</dc:creator>
      <dc:date>2001-01-17T08:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: "date" command in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483592#M799004</link>
      <description>Hi Jessica,&lt;BR /&gt;&lt;BR /&gt;The problem is due to you using the '-u' flag on the date command. This causes date to respond with the date in Coordinated Universal Time which equates to Greenwich Mean Time.&lt;BR /&gt;&lt;BR /&gt;When your job runs at 05:50 EAT, this is either 22:50 or 23:50 the previous day GMT. When you ran the command at 11:25 EAT, GMT was the same day.&lt;BR /&gt;&lt;BR /&gt;Simply remove the -u flag from the date command and you will get the correct day.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;John</description>
      <pubDate>Wed, 17 Jan 2001 10:55:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483592#M799004</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2001-01-17T10:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: "date" command in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483593#M799005</link>
      <description>Using the -u switch to the date command indicates that you want the date for UTC as opposed to your local TZ. Drop the -u switch from the date command.</description>
      <pubDate>Wed, 17 Jan 2001 15:18:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/quot-date-quot-command-in-a-script/m-p/2483593#M799005</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2001-01-17T15:18:54Z</dc:date>
    </item>
  </channel>
</rss>

