<?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: Starting a process with cron in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572376#M30741</link>
    <description>Hi Jerry:&lt;BR /&gt;&lt;BR /&gt;The environment supplied by 'cron' is very sparse.  You can source your $HOME/.profile ahead of calling your script. This can be done in the crontab entry.  Alternatively, you can source your profile within the script itself thereby providing the necessary environmental variables (including PATH). Thirdly, you could create a new file which contains and exports the common variables needed for your application, and source (read) that file within your standard profile; within standard scripts; and/or in a crontab stream. &lt;BR /&gt;&lt;BR /&gt;To source (read) a file within a script, put a dot (".") in front of the script name. For instance, to source a file called 'myscript' you would do: &lt;BR /&gt;&lt;BR /&gt;# . ./myscript #...note the space between the dot and the script name.&lt;BR /&gt;&lt;BR /&gt;While you can source your $HOME/.profile, this generally leads to the annoying "not a typewriter" messages when commands like 'stty' are executed in a non-interactive environment.  You could redirect stdout and stderr to /dev/null although you may miss important messages this way, or you could enhance your profile to execute these commands like this:&lt;BR /&gt;&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;then&lt;BR /&gt;  stty...&lt;BR /&gt;fi&lt;BR /&gt; &lt;BR /&gt;This leads full-circle to the idea of creating a file of environmental variables you need in a file that can be sourced independently of the profile and/or by the profile during login processing.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
    <pubDate>Wed, 29 Aug 2001 18:57:58 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2001-08-29T18:57:58Z</dc:date>
    <item>
      <title>Starting a process with cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572374#M30739</link>
      <description>I have a process that needs to be started each night after my backup.  It must be started as a user other than root.  I can start it while logged in as this user, but it won't start from it's crontab file.  I think that $Path is not set. How do I use cron and set the $PATH as if the user was logged on</description>
      <pubDate>Wed, 29 Aug 2001 18:44:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572374#M30739</guid>
      <dc:creator>Jerry Timm</dc:creator>
      <dc:date>2001-08-29T18:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a process with cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572375#M30740</link>
      <description>is the user that needs to run the process the same user that runs the backup?&lt;BR /&gt;&lt;BR /&gt;If so, why not just append the commands to the end of the backup script.&lt;BR /&gt;&lt;BR /&gt;I do this with several processes that i run after my nightly backup.&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Aug 2001 18:55:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572375#M30740</guid>
      <dc:creator>Edward Alfert_2</dc:creator>
      <dc:date>2001-08-29T18:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a process with cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572376#M30741</link>
      <description>Hi Jerry:&lt;BR /&gt;&lt;BR /&gt;The environment supplied by 'cron' is very sparse.  You can source your $HOME/.profile ahead of calling your script. This can be done in the crontab entry.  Alternatively, you can source your profile within the script itself thereby providing the necessary environmental variables (including PATH). Thirdly, you could create a new file which contains and exports the common variables needed for your application, and source (read) that file within your standard profile; within standard scripts; and/or in a crontab stream. &lt;BR /&gt;&lt;BR /&gt;To source (read) a file within a script, put a dot (".") in front of the script name. For instance, to source a file called 'myscript' you would do: &lt;BR /&gt;&lt;BR /&gt;# . ./myscript #...note the space between the dot and the script name.&lt;BR /&gt;&lt;BR /&gt;While you can source your $HOME/.profile, this generally leads to the annoying "not a typewriter" messages when commands like 'stty' are executed in a non-interactive environment.  You could redirect stdout and stderr to /dev/null although you may miss important messages this way, or you could enhance your profile to execute these commands like this:&lt;BR /&gt;&lt;BR /&gt;if [ -t 0 ]&lt;BR /&gt;then&lt;BR /&gt;  stty...&lt;BR /&gt;fi&lt;BR /&gt; &lt;BR /&gt;This leads full-circle to the idea of creating a file of environmental variables you need in a file that can be sourced independently of the profile and/or by the profile during login processing.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 29 Aug 2001 18:57:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572376#M30741</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-08-29T18:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a process with cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572377#M30742</link>
      <description>Hi Jerry,&lt;BR /&gt;&lt;BR /&gt;You can set your cron job for that user like this.&lt;BR /&gt;&lt;BR /&gt;run "crontab -e" as that user. It will open the file for cron jobs already set by that user else it will open a new file in vi mode. You edit this file and define the schedule and comamnd to be run by cron in this file. The format will be&lt;BR /&gt;&lt;BR /&gt;min hrs day_month month day_week command&lt;BR /&gt;&lt;BR /&gt;so if want to set up a job to be run at say 11pm every night and the job file is /users/user1/cronjob.sh you have to put these values&lt;BR /&gt;&lt;BR /&gt;00 23  * * * /users/user1/cronjob.sh 2&amp;gt;1&amp;amp;&lt;BR /&gt;&lt;BR /&gt;save and exit. You don't have to specify the name of the file where you are saving. Just &lt;ESC&gt;:wq!&lt;BR /&gt;&lt;BR /&gt;The job is now set into cron. You can look at it by using&lt;BR /&gt;"crontab -l"&lt;BR /&gt;&lt;BR /&gt;Read the man pages of crontab for more details.&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;/ESC&gt;</description>
      <pubDate>Wed, 29 Aug 2001 19:00:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572377#M30742</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2001-08-29T19:00:43Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a process with cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572378#M30743</link>
      <description>Hi Jerry,&lt;BR /&gt;&lt;BR /&gt;The following command in the root crontab file will do what you need :&lt;BR /&gt;&lt;BR /&gt;10 22 * * *   /bin/su - UserName   -c  "/users/user1/bin/user1Script.sh  arg1 arg2"&lt;BR /&gt;&lt;BR /&gt;So, the script user1Script.sh will be running under the environment of user1.&lt;BR /&gt;&lt;BR /&gt;Magdi&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Aug 2001 05:52:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572378#M30743</guid>
      <dc:creator>Magdi KAMAL</dc:creator>
      <dc:date>2001-08-30T05:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Starting a process with cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572379#M30744</link>
      <description>&lt;BR /&gt;Oops, "UserName" stand for user1 in this case.&lt;BR /&gt;&lt;BR /&gt;Magdi&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Aug 2001 05:55:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/starting-a-process-with-cron/m-p/2572379#M30744</guid>
      <dc:creator>Magdi KAMAL</dc:creator>
      <dc:date>2001-08-30T05:55:20Z</dc:date>
    </item>
  </channel>
</rss>

