<?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: Cron and posix programming in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448300#M10086</link>
    <description>I put  in front of % in my cron jobs.&lt;BR /&gt;&lt;BR /&gt;33,03 * * * * xx=`date +%d`; date +"%D.%X" &amp;gt;&amp;gt;/var/adm/sa/vmstat.$xx&lt;BR /&gt;</description>
    <pubDate>Thu, 28 Sep 2000 05:37:28 GMT</pubDate>
    <dc:creator>unix team_4</dc:creator>
    <dc:date>2000-09-28T05:37:28Z</dc:date>
    <item>
      <title>Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448294#M10080</link>
      <description>This should be an easy one for someone out there.&lt;BR /&gt;&lt;BR /&gt;Im trying to run a command and redirect it to a file.&lt;BR /&gt;&lt;BR /&gt;The command does not matter but here is the problem Im having after redirection.&lt;BR /&gt;&lt;BR /&gt;On the command line I can run "some_command &amp;gt; /tmp/temp_`date +%m%d`.log" and it works the way we want it, but it does not work running from cron.  I know it has to be some environment variable but Im at a loss.  The file when run from cron ends up cutting off after the underscore.  Any help would be most appreciated.</description>
      <pubDate>Wed, 27 Sep 2000 13:36:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448294#M10080</guid>
      <dc:creator>Todd Bowden</dc:creator>
      <dc:date>2000-09-27T13:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448295#M10081</link>
      <description>I don't think that it's an environment variable, I think that it's the way that cron issues the command.&lt;BR /&gt;&lt;BR /&gt;One workaround is to get cron to call a script that itself calls &lt;BR /&gt;some_command &amp;gt; /tmp/temp_`date +%m%d`.log&lt;BR /&gt;&lt;BR /&gt;If some_command is a script that you have control over then get it to redirect its standard output/error with:-&lt;BR /&gt;&lt;BR /&gt;exec 1&amp;gt; &lt;LOGFILE&gt; 2&amp;gt;&amp;amp;1&lt;/LOGFILE&gt;</description>
      <pubDate>Wed, 27 Sep 2000 13:43:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448295#M10081</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2000-09-27T13:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448296#M10082</link>
      <description>That would be a good work around, but can I insert that `date +%m%d` to append it to the log file in the crontab entry?  If I can how?</description>
      <pubDate>Wed, 27 Sep 2000 13:50:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448296#M10082</guid>
      <dc:creator>Todd Bowden</dc:creator>
      <dc:date>2000-09-27T13:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448297#M10083</link>
      <description>Yes there is...&lt;BR /&gt;&lt;BR /&gt;After trying the same thing myself and checking cron's log (/var/adm/cron/log) it appears that cron doesn't like the % characters.&lt;BR /&gt;&lt;BR /&gt;If you escape them with backslash then it works eg&lt;BR /&gt;&lt;BR /&gt;bdf &amp;gt; /tmp/test.`date +\%m\%d`.log&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Sep 2000 13:58:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448297#M10083</guid>
      <dc:creator>John Palmer</dc:creator>
      <dc:date>2000-09-27T13:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448298#M10084</link>
      <description>why don't you script i.e. specify $1 as your command i.e. :-&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;COMMAND=$1&lt;BR /&gt;&lt;BR /&gt;DDD=$(date +%m%d)&lt;BR /&gt;&lt;BR /&gt;$1 &amp;gt;/tmp/temp_$DDD.log&lt;BR /&gt;&lt;BR /&gt;in cron &lt;BR /&gt;&lt;BR /&gt;time * * * script bdf&lt;BR /&gt;&lt;BR /&gt;just a thought</description>
      <pubDate>Wed, 27 Sep 2000 14:01:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448298#M10084</guid>
      <dc:creator>Devbinder Singh Marway</dc:creator>
      <dc:date>2000-09-27T14:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448299#M10085</link>
      <description>Ok, how do I give myself points? HAHA&lt;BR /&gt;&lt;BR /&gt;I found the answer I was looking for.&lt;BR /&gt;&lt;BR /&gt;in cron it interprets % characters as new lines.  Here is a excerpt from crontab(1m)&lt;BR /&gt;&lt;BR /&gt;A percent character (%) in this field (unless&lt;BR /&gt;      escaped by a backslash ()) is translated to a newline character,&lt;BR /&gt;      dividing the field into "lines".  Only the first "line" (up to a % or&lt;BR /&gt;      end-of-line) of the command field is executed by the shell.  Any other&lt;BR /&gt;      "lines" are made available to the command as standard input.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;so when I do the following in cron it works:&lt;BR /&gt;&lt;BR /&gt;some_command &amp;gt; /tmp/temp_`date +%m%d`.log&lt;BR /&gt;&lt;BR /&gt;you have to escape the % signs.</description>
      <pubDate>Wed, 27 Sep 2000 14:04:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448299#M10085</guid>
      <dc:creator>Todd Bowden</dc:creator>
      <dc:date>2000-09-27T14:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Cron and posix programming</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448300#M10086</link>
      <description>I put  in front of % in my cron jobs.&lt;BR /&gt;&lt;BR /&gt;33,03 * * * * xx=`date +%d`; date +"%D.%X" &amp;gt;&amp;gt;/var/adm/sa/vmstat.$xx&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Sep 2000 05:37:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/cron-and-posix-programming/m-p/2448300#M10086</guid>
      <dc:creator>unix team_4</dc:creator>
      <dc:date>2000-09-28T05:37:28Z</dc:date>
    </item>
  </channel>
</rss>

