<?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: Variables in crontab in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389283#M665221</link>
    <description>Our database group have a number of scripts to set the environment variables for the desired database instance. We can then run these to set up the environment within crontabs; e.g.&lt;BR /&gt;&lt;BR /&gt;43 11 * * *  .  /home/informix/env/env_xxxx; script_to_run&lt;BR /&gt;&lt;BR /&gt;The dot before the first script name causes initial script to run in the crontab shell; this sets up all of the variables for the second script.&lt;BR /&gt;</description>
    <pubDate>Tue, 31 Mar 2009 00:21:19 GMT</pubDate>
    <dc:creator>George Spencer_4</dc:creator>
    <dc:date>2009-03-31T00:21:19Z</dc:date>
    <item>
      <title>Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389273#M665211</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;it looks like the following doesn't work:&lt;BR /&gt;&lt;BR /&gt;=====begin crontab======&lt;BR /&gt;ORACLE_HOME=/very/long/path/to/oracle/10g/db&lt;BR /&gt;&lt;BR /&gt;1 2 * * * $ORACLE_HOME/scripts/run1.sh&lt;BR /&gt;1 2 * * * $ORACLE_HOME/scripts/run2.sh&lt;BR /&gt;#[...]&lt;BR /&gt;1 2 * * * $ORACLE_HOME/scripts/run1000.sh&lt;BR /&gt;=====end crontab======&lt;BR /&gt;&lt;BR /&gt;Does anybody know if there is any way to define my own variables to be used in crontab entries? I wouldn't like to take advantage of external files with variables definitions.</description>
      <pubDate>Fri, 27 Mar 2009 11:14:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389273#M665211</guid>
      <dc:creator>wojtek75</dc:creator>
      <dc:date>2009-03-27T11:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389274#M665212</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Put the variables inside the script and schedule the script in crontab.&lt;BR /&gt;&lt;BR /&gt;Or use the absolute path in the cron entry.</description>
      <pubDate>Fri, 27 Mar 2009 11:17:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389274#M665212</guid>
      <dc:creator>Ganesan R</dc:creator>
      <dc:date>2009-03-27T11:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389275#M665213</link>
      <description>You should embed these variables within your script.&lt;BR /&gt;&lt;BR /&gt;Also,you can create an environmental file to have all the variables and you can call this .env in your script or both like &lt;BR /&gt;&lt;BR /&gt;0 1 * * * (/home/test/.env /home/test/run.sh)</description>
      <pubDate>Fri, 27 Mar 2009 11:20:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389275#M665213</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2009-03-27T11:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389276#M665214</link>
      <description>Yep, but what if I need a variable in the path to the script? I don't want to use absolute as it is a kind of dynamic one.</description>
      <pubDate>Fri, 27 Mar 2009 11:23:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389276#M665214</guid>
      <dc:creator>wojtek75</dc:creator>
      <dc:date>2009-03-27T11:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389277#M665215</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If you don't want to code necessary variables in your script and/or you don't want to source (read) another file of variables when you execute your script, you could do:&lt;BR /&gt;&lt;BR /&gt;# cat /tmp/mysh&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;echo "${WHO} --- ${WHY}"&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;...with a 'crontab' entry like:&lt;BR /&gt;&lt;BR /&gt;* * * * * ( export WHO="me"; export WHY="I said so"; /tmp/mysh )&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Mar 2009 11:33:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389277#M665215</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-03-27T11:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389278#M665216</link>
      <description>&lt;!--!*#--&gt;&amp;gt; Yep, but what if I need a variable in the&lt;BR /&gt;&amp;gt; path to the script?&lt;BR /&gt;&lt;BR /&gt;Then you may be doomed.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;  I don't want to use&lt;BR /&gt;&amp;gt; absolute as it is a kind of dynamic one.&lt;BR /&gt;&lt;BR /&gt;Yes, but if cron has a way to get the value&lt;BR /&gt;of your variable, then it's a mystery to me.&lt;BR /&gt;I'd say that you need to have a script in&lt;BR /&gt;some fixed, known location, so that cron can&lt;BR /&gt;find it.  That script can then do anything&lt;BR /&gt;dynamic which you need to do.&lt;BR /&gt;&lt;BR /&gt;Of course, how you'll choose to inform that&lt;BR /&gt;script about the dynamic stuff is still an&lt;BR /&gt;open question, but many things are possible.</description>
      <pubDate>Fri, 27 Mar 2009 11:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389278#M665216</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-03-27T11:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389279#M665217</link>
      <description>So you'll only want to shorten the names of the scripts to make the crontab easier to read?&lt;BR /&gt;&lt;BR /&gt;Use symbolic links.&lt;BR /&gt;&lt;BR /&gt;First make a directory for the links in some convenient path:&lt;BR /&gt;&lt;BR /&gt;mkdir /usr/local/cronscripts&lt;BR /&gt;&lt;BR /&gt;Then link all the scripts to the directory:&lt;BR /&gt;&lt;BR /&gt;ln -s /very/long/path/to/oracle/10g/db/scripts/run*.sh /usr/local/cronscripts&lt;BR /&gt;&lt;BR /&gt;After this, you should be able to setup your crontab entries like this:&lt;BR /&gt;&lt;BR /&gt;1 2 * * * /usr/local/cronscripts/run1.sh&lt;BR /&gt;...etc...&lt;BR /&gt;&lt;BR /&gt;Of course, you should keep in mind that the ORACLE_HOME variable is not defined when the scripts are executed, unless the scripts themselves handle that.&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Fri, 27 Mar 2009 13:10:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389279#M665217</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2009-03-27T13:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389280#M665218</link>
      <description>"=====begin crontab======&lt;BR /&gt;ORACLE_HOME=/very/long/path/to/oracle/10g/db&lt;BR /&gt;&lt;BR /&gt;1 2 * * * $ORACLE_HOME/scripts/run1.sh&lt;BR /&gt;1 2 * * * $ORACLE_HOME/scripts/run2.sh&lt;BR /&gt;#[...]&lt;BR /&gt;1 2 * * * $ORACLE_HOME/scripts/run1000.sh&lt;BR /&gt;=====end crontab======"&lt;BR /&gt;&lt;BR /&gt;that can't be done...&lt;BR /&gt;&lt;BR /&gt;you might consider making a symbolic link, like /oracle_home and point at your long path, so that crontab entries become&lt;BR /&gt;&lt;BR /&gt;/oracle_home/scripts/run1.sh &lt;BR /&gt;&lt;BR /&gt;then, as suggested previously, have your scripts source whatever environment files are necessary.&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Mar 2009 13:10:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389280#M665218</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-03-27T13:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389281#M665219</link>
      <description>cron is not like an interactive shell -- everything must be setup in your script. f your scripts bounce around, I hope you have lots of ways to track them, but I would recommend a single script that handles everything. Rather than hardcode the script names in cron, use a top level script with a runtime parameter to specify what to do. This top level script would also take care of exporting the correct variables and setting values such as $PATH .</description>
      <pubDate>Fri, 27 Mar 2009 16:31:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389281#M665219</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2009-03-27T16:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389282#M665220</link>
      <description>&amp;gt;Does anybody know if there is any way to define my own variables to be used in crontab entries?&lt;BR /&gt;&lt;BR /&gt;You could have a template crontab file and then write a sed script to change your "variables", then submit to crontab.</description>
      <pubDate>Fri, 27 Mar 2009 22:31:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389282#M665220</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-03-27T22:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variables in crontab</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389283#M665221</link>
      <description>Our database group have a number of scripts to set the environment variables for the desired database instance. We can then run these to set up the environment within crontabs; e.g.&lt;BR /&gt;&lt;BR /&gt;43 11 * * *  .  /home/informix/env/env_xxxx; script_to_run&lt;BR /&gt;&lt;BR /&gt;The dot before the first script name causes initial script to run in the crontab shell; this sets up all of the variables for the second script.&lt;BR /&gt;</description>
      <pubDate>Tue, 31 Mar 2009 00:21:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/variables-in-crontab/m-p/4389283#M665221</guid>
      <dc:creator>George Spencer_4</dc:creator>
      <dc:date>2009-03-31T00:21:19Z</dc:date>
    </item>
  </channel>
</rss>

