<?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: Need help with scripting. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419087#M354166</link>
    <description>Silly me, thanks a lot Pete.&lt;BR /&gt;Putting the full path names solved my problem.&lt;BR /&gt;Thanks - I have assigned points.</description>
    <pubDate>Wed, 13 May 2009 10:30:34 GMT</pubDate>
    <dc:creator>mjos</dc:creator>
    <dc:date>2009-05-13T10:30:34Z</dc:date>
    <item>
      <title>Need help with scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419085#M354164</link>
      <description>Hi,&lt;BR /&gt;I have the following script for purging &amp;amp; archive old files from tmp. When I manually run the script, it runs fine &amp;amp; give archive.gz file.&lt;BR /&gt;But when I schedule the same script to run in cron, it produces a 0 bytes file.&lt;BR /&gt;Can somebody please help what is going wrong when cron runs the same script.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;set -u&lt;BR /&gt;SEARCH=/tmp/xyz&lt;BR /&gt;GZDIR=/tmp/xyz/archive&lt;BR /&gt;GZFILE=${GZDIR}/arch_$(date +%Y%m%d).gz&lt;BR /&gt;cd ${SEARCH} || exit 1&lt;BR /&gt;FILES=$(find . -type f -mtime +10)&lt;BR /&gt;[ -z "${FILES}" ] &amp;amp;&amp;amp; { echo "no files older than 10-days"; exit 1; }&lt;BR /&gt;tar -cvf - ${FILES} | gzip - &amp;gt; ${GZFILE}&lt;BR /&gt;find ${GZDIR} -type f -name "*.gz" -mtime +10 -exec rm {} +&lt;BR /&gt;#rm ${FILES} #...to remove what you archived...&lt;BR /&gt;exit 0&lt;BR /&gt;</description>
      <pubDate>Wed, 13 May 2009 10:05:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419085#M354164</guid>
      <dc:creator>mjos</dc:creator>
      <dc:date>2009-05-13T10:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419086#M354165</link>
      <description>Whenever we come across a script that runs fine from the command line yet does not work from cron, it is nearly always because of the sparse environment provided by cron.  Check the man pages and you will find that the PATH for cron is minimal, and many environment variables are not set.  The first thing I would do is make sure you either put a PATH statement in the beginning of your script or use full path names for all your commands (tar=/usr/bin/tar, find=/usr/bin/find, etc.)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 13 May 2009 10:12:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419086#M354165</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2009-05-13T10:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419087#M354166</link>
      <description>Silly me, thanks a lot Pete.&lt;BR /&gt;Putting the full path names solved my problem.&lt;BR /&gt;Thanks - I have assigned points.</description>
      <pubDate>Wed, 13 May 2009 10:30:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419087#M354166</guid>
      <dc:creator>mjos</dc:creator>
      <dc:date>2009-05-13T10:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with scripting.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419088#M354167</link>
      <description>&amp;gt;Putting the full path names solved my problem.&lt;BR /&gt;&lt;BR /&gt;It seems that gzip was the only one that needed it.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Pete: tar=/usr/bin/tar, find=/usr/bin/find, etc.)&lt;BR /&gt;&lt;BR /&gt;None of these are really needed, they are in the default cron PATH.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 14 May 2009 01:34:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-with-scripting/m-p/4419088#M354167</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-05-14T01:34:47Z</dc:date>
    </item>
  </channel>
</rss>

