<?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: Script output to a log file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355655#M713044</link>
    <description>If you wish to capture any user input as well, you can use the script command;&lt;BR /&gt;&lt;BR /&gt;script /tmp/output.log&lt;BR /&gt;&lt;YOUR_SCRIPT&gt;&lt;/YOUR_SCRIPT&gt;exit    (to complete script logging when your script is finished).</description>
    <pubDate>Thu, 12 Aug 2004 09:08:31 GMT</pubDate>
    <dc:creator>Chris Wilshaw</dc:creator>
    <dc:date>2004-08-12T09:08:31Z</dc:date>
    <item>
      <title>Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355652#M713041</link>
      <description>&lt;BR /&gt;I have a script that runs to check some files, etc... &lt;BR /&gt;&lt;BR /&gt;Is there a way to have all output from the script put into a log file ?? now when you run it just scrolls onto the screen..&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Aug 2004 08:59:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355652#M713041</guid>
      <dc:creator>MikeL_4</dc:creator>
      <dc:date>2004-08-12T08:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355653#M713042</link>
      <description>Hi,&lt;BR /&gt;redirect the output:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;yourscript.sh &amp;gt;/dir/logoutput.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt;&amp;gt;/dir/logoutput.log  : redirects standard output there&lt;BR /&gt;2&amp;gt;&amp;amp;1                 : redirect standard error&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;  Massimo</description>
      <pubDate>Thu, 12 Aug 2004 09:02:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355653#M713042</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2004-08-12T09:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355654#M713043</link>
      <description>Oh simply:&lt;BR /&gt;&lt;BR /&gt;unixprompt#  scriptname.ksh | tee script.log&lt;BR /&gt;&lt;BR /&gt;It'll run your script displaying output while at the same time capturing output to a logfile named script.log.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 12 Aug 2004 09:04:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355654#M713043</guid>
      <dc:creator>Alzhy</dc:creator>
      <dc:date>2004-08-12T09:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355655#M713044</link>
      <description>If you wish to capture any user input as well, you can use the script command;&lt;BR /&gt;&lt;BR /&gt;script /tmp/output.log&lt;BR /&gt;&lt;YOUR_SCRIPT&gt;&lt;/YOUR_SCRIPT&gt;exit    (to complete script logging when your script is finished).</description>
      <pubDate>Thu, 12 Aug 2004 09:08:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355655#M713044</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2004-08-12T09:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355656#M713045</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;It is a bit cryptical :-) but take a look at the script command.&lt;BR /&gt;&lt;BR /&gt;# script output_file&lt;BR /&gt;# your_script&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Robert-Jan</description>
      <pubDate>Thu, 12 Aug 2004 09:13:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355656#M713045</guid>
      <dc:creator>Robert-Jan Goossens</dc:creator>
      <dc:date>2004-08-12T09:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355657#M713046</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;easy just redirect the output to your desired logfile&lt;BR /&gt;&lt;BR /&gt;"your_script" &amp;gt; "logfile"&lt;BR /&gt;&lt;BR /&gt;eg&lt;BR /&gt;&lt;BR /&gt;script.sh &amp;gt; /tmp/output.log&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Franky</description>
      <pubDate>Thu, 12 Aug 2004 09:13:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355657#M713046</guid>
      <dc:creator>Franky_1</dc:creator>
      <dc:date>2004-08-12T09:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355658#M713047</link>
      <description>You can redirect the outputs of a shell script to a log file as,&lt;BR /&gt;&lt;BR /&gt; redirection with redirectors 1&amp;gt; 2&amp;gt; &lt;BR /&gt; where 1 - stdout&lt;BR /&gt;       2 - stderr&lt;BR /&gt;&lt;BR /&gt; Example: ksh test.ksh 1&amp;gt;test.log 2&amp;gt;test.log&lt;BR /&gt;  or &lt;BR /&gt;          ksh test.ksh 1&amp;gt;test.log 2&amp;gt;&amp;amp;1&lt;BR /&gt;&lt;BR /&gt; Using script,&lt;BR /&gt;  script outputfile&lt;BR /&gt;  ksh test.ksh&lt;BR /&gt;   &lt;BR /&gt;  exit to stop the script&lt;BR /&gt;&lt;BR /&gt; Using tee command&lt;BR /&gt;  ksh test.ksh | tee output file&lt;BR /&gt;&lt;BR /&gt; Tee will stop upon exiting from shell script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; You can scroll the log files in parralel as tail -f &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt; And more important;&lt;BR /&gt;  you can use debugging mode as,&lt;BR /&gt;  set -x or set -v&lt;BR /&gt;  on start of script to keep the track of execution of shell sctipts&lt;BR /&gt;&lt;BR /&gt;_muthu_ &lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 12 Aug 2004 09:51:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355658#M713047</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-08-12T09:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355659#M713048</link>
      <description>G'day,&lt;BR /&gt;&lt;BR /&gt;I like using the stderr duplication and then using tee, e.g. for bash, ksh or zsh:&lt;BR /&gt;&lt;BR /&gt;    my_script 2&amp;gt;&amp;amp;1 | tee my_script_output&lt;BR /&gt;&lt;BR /&gt;Alternatively, I like creating a 'write to a log file' function within the script and then tailing this log file in another window. This lets me create a nice timestamp and maybe error/warning/info level for the log messages.&lt;BR /&gt;&lt;BR /&gt;I usually make log_detailed and log_summary summary functions. These create two different log files; a detailed log and a summary log. The detailed log file contains all the messages that went into the summary log file along with (funnily enough (-:  ) more detailed messages.&lt;BR /&gt;&lt;BR /&gt;I have written vim syntax files to vary the highlighting and colours used based on the error levels. These allow a developer to easily see exceptions and also to distinguish between messages from our middleware and messages from the application that they have written.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Rob</description>
      <pubDate>Tue, 17 Aug 2004 09:25:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355659#M713048</guid>
      <dc:creator>Robert Wells_3</dc:creator>
      <dc:date>2004-08-17T09:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script output to a log file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355660#M713049</link>
      <description>The "tee -a" option can be very useful for capturing output. &lt;BR /&gt;&lt;BR /&gt;When you invoke your script, pipe to tee -a as well.&lt;BR /&gt;&lt;BR /&gt;Define your $LOG_FILE and then pipe the command to tee -a $LOG_FILE&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Aug 2004 11:07:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-output-to-a-log-file/m-p/3355660#M713049</guid>
      <dc:creator>Rick Garland</dc:creator>
      <dc:date>2004-08-17T11:07:10Z</dc:date>
    </item>
  </channel>
</rss>

