<?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: Crontab in korn shell? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453177#M209084</link>
    <description>Hi,&lt;BR /&gt; &lt;BR /&gt;cron itself runs with the default Posix shell but you can run your programs through any shell:&lt;BR /&gt; &lt;BR /&gt;either specify it with the instruction:&lt;BR /&gt;5 * * * * ksh program.ksh&lt;BR /&gt;&lt;BR /&gt;or specify it in the shell script itself:&lt;BR /&gt;#! /bin/ksh&lt;BR /&gt;#  "#!" as first characters in script will define the interpreter.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry Poels.&lt;BR /&gt;</description>
    <pubDate>Fri, 31 Dec 2004 01:40:21 GMT</pubDate>
    <dc:creator>Thierry Poels_1</dc:creator>
    <dc:date>2004-12-31T01:40:21Z</dc:date>
    <item>
      <title>Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453176#M209083</link>
      <description>When I submit my cron job to the crontab, it prompted me "warning: commands will be executed using /usr/bin/sh". what if I have used korn shell for my script, is there anything I do to save me from rewritting is another shell?&lt;BR /&gt;&lt;BR /&gt;just to confirm I have add my job as follow:&lt;BR /&gt;"5 * * * * /users/tester/BACKUP_LOG/main.sh" for it to run at every 5 mins, is this correct?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Dec 2004 01:24:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453176#M209083</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2004-12-31T01:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453177#M209084</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;cron itself runs with the default Posix shell but you can run your programs through any shell:&lt;BR /&gt; &lt;BR /&gt;either specify it with the instruction:&lt;BR /&gt;5 * * * * ksh program.ksh&lt;BR /&gt;&lt;BR /&gt;or specify it in the shell script itself:&lt;BR /&gt;#! /bin/ksh&lt;BR /&gt;#  "#!" as first characters in script will define the interpreter.&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry Poels.&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Dec 2004 01:40:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453177#M209084</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2004-12-31T01:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453178#M209085</link>
      <description>ooops forgot second question:&lt;BR /&gt; &lt;BR /&gt;5 * * * *&lt;BR /&gt;will run the job 5 minutes past every hour: 00:05, 01:05, 02:05, .... 23,05&lt;BR /&gt; &lt;BR /&gt;To run it every 5 minutes you'll need to specify the "minutes":&lt;BR /&gt;0,5,10,15,20,25,30,35,40,45,50,55 * * * * &lt;BR /&gt;(sorry no easier way)&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry Poels.</description>
      <pubDate>Fri, 31 Dec 2004 01:43:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453178#M209085</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2004-12-31T01:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453179#M209086</link>
      <description>The first line of any script should indicate the shell to be used (for example) &lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;UNIX will attempt to execute the file in the current shell, and try to process the included command strings within the file using the syntax rules of the current shell. &lt;BR /&gt;&lt;BR /&gt;So, if you are using the Bourne Shell as your default environment and the ASCII file contains a list of UNIX command structures formatted how the Bourne Shell likes them to be formatted, all will work fine. &lt;BR /&gt;&lt;BR /&gt;However, if you try and execute a C Shell file with a different syntax structure, the Operating System will complain about unrecognised commands and syntax errors. &lt;BR /&gt;&lt;BR /&gt;sks</description>
      <pubDate>Fri, 31 Dec 2004 01:49:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453179#M209086</guid>
      <dc:creator>Sanjay Kumar Suri</dc:creator>
      <dc:date>2004-12-31T01:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453180#M209087</link>
      <description>Hi Thiery,&lt;BR /&gt;&lt;BR /&gt;  It seems strange, I have done wat you say, but the script cant seem to run well in crontab, however if u execute it from the command line, it works without any problem.. can you think of any reason for this?&lt;BR /&gt;&lt;BR /&gt;***It goes directly to the second while loop ignoring the first one..&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Henry</description>
      <pubDate>Fri, 31 Dec 2004 01:56:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453180#M209087</guid>
      <dc:creator>Henry Chua</dc:creator>
      <dc:date>2004-12-31T01:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453181#M209088</link>
      <description>hi,&lt;BR /&gt; &lt;BR /&gt;I guess the difference is the "current directory".&lt;BR /&gt;Some files are put in the current directory as no full path is supplied.  When the job is started through cron it is started in the user's home directory.  Where did your run the job manually?&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Fri, 31 Dec 2004 02:04:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453181#M209088</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2004-12-31T02:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453182#M209089</link>
      <description>In crontab you write:&lt;BR /&gt;5 * * * * /usr/bin/ksh /users/tester/BACKUP_LOG/main.sh&lt;BR /&gt;In main.sh cript you specify ksh by&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;....contents of main.sh...&lt;BR /&gt;...&lt;BR /&gt;Best regard.&lt;BR /&gt;PS: You should refer (Shell Basic Guide)&lt;BR /&gt;&lt;A href="http://www.docs.hp.com/en/B2355-90046/index.html" target="_blank"&gt;http://www.docs.hp.com/en/B2355-90046/index.html&lt;/A&gt;</description>
      <pubDate>Fri, 31 Dec 2004 04:07:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453182#M209089</guid>
      <dc:creator>Nguyen Anh Tien</dc:creator>
      <dc:date>2004-12-31T04:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453183#M209090</link>
      <description>Hi Henry,&lt;BR /&gt;one thing that could cause a problem is the first of these three lines:&lt;BR /&gt;find $SDT &amp;gt; map2.txt&lt;BR /&gt;diff $MAP2 $MAP1 &amp;gt; $DMAP&lt;BR /&gt;cp $MAP2 $MAP1&lt;BR /&gt;&lt;BR /&gt;where the find command produces output in the current directory - whatever that might be - and perhaps it should have been put elsewhere, e.g.:&lt;BR /&gt;find "$SDT" &amp;gt; $MAP2&lt;BR /&gt; &lt;BR /&gt;Just a suggestion....&lt;BR /&gt; &lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Dec 2004 07:33:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453183#M209090</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2004-12-31T07:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453184#M209091</link>
      <description>Several points:&lt;BR /&gt; &lt;BR /&gt;- /bin doesn't exist in HP-UX and hasn't been there for more than a decade. Just like Solaris and other SysV flavors of Unix that adopted the V.4 filesystem layout standard, the correct directory is /usr/bin. /bin (and /lib) in HP-UX are actually temporary symbolic links that may not be installed automatically in future versions. The HP-UX POSIX shell (which is *NOT* the Bourne shell) is actually a superset of Korn shell. In facr, Korn, BASH and HP's POSIX shell are all "POSIX" shells and virtually identical for shell scripting. The real Bourne shell is located in /usr/old/bin/sh.&lt;BR /&gt; &lt;BR /&gt;- As mentioned, the desired interpreter is used when the (strongly recomended) standard #! line is used in every script. This allows any interpreter (/usr/bin/sh, /usr/bin/ksh, /opt/perl/bin/perl, /usr/local/bin/bash, etc) to be used at either a shell prompt or in an at or cron job.&lt;BR /&gt; &lt;BR /&gt;- The cron environment is VERY different than your login shell. cron does not login and therefore /etc/profile and .profile are not executed and you'll end up with:&lt;BR /&gt; &lt;BR /&gt;HOME=user's-home-directory&lt;BR /&gt;LOGNAME=user's-login-id&lt;BR /&gt;PATH=/usr/bin:/usr/sbin:.&lt;BR /&gt;SHELL=/usr/bin/sh&lt;BR /&gt; &lt;BR /&gt;That's from the crontab man page. That's why your script isn't working the same way--it depends on your login shell environment.&lt;BR /&gt; &lt;BR /&gt;So when you write scripts for cron:&lt;BR /&gt; &lt;BR /&gt;- Always include #! as line 1 with the dfesired interpreter. cron will start your script with the POSIX shell, then switch (if necessary) based on line 1.&lt;BR /&gt; &lt;BR /&gt;- Always hardcode your PATH inside the script. Never include directories you don't need and never include . or .. for file references. Always use fullpathnames for files so there is no ambiguity about exactly what you want.&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Fri, 31 Dec 2004 10:54:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453184#M209091</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-12-31T10:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Crontab in korn shell?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453185#M209092</link>
      <description>We commonly include scripts using serveral different shells in cron.&lt;BR /&gt;&lt;BR /&gt;cron itself uses Posix, with no environment. On a day to day basis our cron runs posix jobs, korn shell jobs and a few c shell and bsh jobs that certain applications require.&lt;BR /&gt;&lt;BR /&gt;It all works, last time I checked the cron log.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 03 Jan 2005 01:12:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/crontab-in-korn-shell/m-p/3453185#M209092</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-01-03T01:12:21Z</dc:date>
    </item>
  </channel>
</rss>

