    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>Linux.com :: Fedora/RH best practices for logging from init scripts...</title>
        <link>http://www.linux.com/archive/forums/topic/3192</link>
        <description>Everything Linux and Open Source</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Linux.com Admin</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.linux.com" /> 
        <admin:errorReportsTo rdf:resource="mailto:noreply@linux.com" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>



<div class="xarbb-noteswrapper">
</div>

   <div class="xarbb-noteswrapper">
       <div class="xar-sub rightnote">
           <div>
                    <a href="http://www.linux.com/archive/forums/topic/3287">
Previous Topic</a>
|
                    <a href="http://www.linux.com/archive/forums/topic/3265">
Next Topic</a>
</div>

           <div>
                    <a href="http://www.linux.com/archive/forums/printtopic/3192?theme=print">
Print this topic</a> |
You are not subscribed            </div>
        </div>
        <div style="clear: both;"></div>
    </div>

    <h1>
        <a class="xar-title" href="http://www.linux.com/archive/forums/topic/3192">Fedora/RH best practices for logging from init scripts...</a>
   </h1>


   <div class="xarbb-topiccontrols">
<form action="http://www.linux.com/archive/forums?func=jump" method="post">
   <label for="xarbb_jump_menu">Forum Jump</label>
    <select name="f" id="xarbb_jump_menu" onchange="this.form.submit();">
        <optgroup label="Options">
            <option value="5" selected="selected">
Please select forum            </option>
            <option value="5">--------------------</option>
        </optgroup>
        <optgroup label="Forums">
                <option value="1">New to Linux</option>
                <option value="2">Hardware</option>
                <option value="3">Linux Distributions</option>
                <option value="4">Applications</option>
                <option value="5">Programming and Development</option>
                <option value="6">Miscellaneous Discussion</option>
                <option value="7">Linux.com Writers Forum</option>
                <option value="8">Jobs</option>
        </optgroup>
    </select>
    <input type="submit" class="button" value="Jump" />
</form>
<div style="clear: both;"></div>
   </div>

   <div class="xarbb-topiccontrols">

<span class="xar-sub">
    <a href="http://www.linux.com/archive/forums">
Forum Index    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/category/4181">
        Forums 
    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/forum/5">
        Programming and Development   </a>
</span>
<div style="clear: both;"></div>
   </div>

<div class="xarbb-tablewrapper">



   <table>
       <tr>
           <th scope="col">
Author</th>
           <th scope="col">
Message</th>
       </tr>



            <tr>
                <td class="xar-norm author">
                    <div>
                        <a href="http://www.linux.com/archive/roles/411924">cmarkle</a>
                   </div>
                   <div class="xar-sub">
Joined: Oct 17, 2008<br/>Posts: 5                        <br />
                        <a href="http://www.linux.com/archive/forums?by=411924&amp;func=searchtopics">
Other Topics</a>
                   </div>
               </td>

               <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted Oct 17, 2008 at 10:12:34 PM</span>
                       </div>



<div style="float: left;">
                           <strong class="xar-sub">
Subject: Fedora/RH best practices for logging from init scripts...                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div>
                        ...prior to syslogd being up... I have an init script that runs before syslogd is up. I'd like it to be able to output to syslog so that after the system is fully booted, I can find some results from the script there. My OS's are fc1, fc4 and Centos 5 (all Red Hat variations). What is the best way for me to log output from an init script that runs before syslogd is up? For the life of me I can't find very good references to this on Google et al. Any pointers on this or refs to materials that discuss it would be great. Thanks in advance...</div>

                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/3192#top">
Back to top</a>
</td>
               <td class="xar-alt">

                        <a href="http://www.linux.com/archive/roles/411924">
                            <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                        </a>
                        <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=411924">
                            <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                       </a>
                            <a href="http://">
                                <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                           </a>
</td>
           </tr>





           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/412412">
                                sergiu                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Oct 25, 2008<br/>Posts: 1<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=412412&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-accent message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Oct 25, 2008 9:26:30 PM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1201640" href="http://www.linux.com/archive/forums/topic/3192#1201640">
                                    Fedora/RH best practices for logging from init scripts...                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        I'm not a programmer, but I assume that it would be good to push the output into a text file, like:
./myscript &gt; textfile.txt
then write a script for syslog-ng, that when it starts, to copy the whole textfile.txt into your log files, like:
cat /yourtextfilelocation/textfile.txt &gt;&gt; /var/log/syslog.
Again, I'm not a programmer, and I'm not sure my solution is the best.                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/3192#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/412412">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=412412">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
</td>
           </tr>

           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/381729">
                                V. L. Simpson                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Jan 01, 1970<br/>Posts: 1<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=381729&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Oct 26, 2008 4:47:42 PM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1201688" href="http://www.linux.com/archive/forums/topic/3192#1201688">
                                    Fedora/RH best practices for logging from init scripts...                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        Try the logger command.
http://www.linuxmanpages.com/man1/logger.1.php                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/3192#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/381729">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=381729">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://vls.freeshell.org">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
</td>
           </tr>

           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/412591">
                                debianadmin                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Oct 29, 2008<br/>Posts: 2<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=412591&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-accent message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Oct 29, 2008 9:17:58 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1201865" href="http://www.linux.com/archive/forums/topic/3192#1201865">
                                    Re:  Fedora/RH best practices for logging from init scripts.                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        The solution will probably be a combination of the above two suggestions.  Since syslogd is not running, you might as well pipe the output directly to /var/log/syslog, but I wouldn't do that to be honest, since the file /var/log/syslog is created by syslogd and has a special format, which you would probably mess up.  I would rather just choose a different file, like /var/log/initscripts instead. Do not forget to catch stderr as well.  You can in your script add this at the very top (right after the shebang line):
[code=xml]
exec &gt; /var/log/initscripts 2&gt;&amp;1
[/code]
then all the output any command in your script generates will be appended to /var/log/initscripts. If you additionally want to use syslog, you should use logger when syslogd is running:
[code=xml]
logger -f /var/log/initscripts
[/code]
This command should run after syslogd is started.                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/3192#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/412591">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=412591">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
</td>
           </tr>

           <tr>
               <td class="xar-norm author">
                   <strong>

                            <a href="http://www.linux.com/archive/roles/412591">
                                debianadmin                           </a>
</strong>

                   <span class="xar-sub">
<br />
Joined Oct 29, 2008<br/>Posts: 2<br />
                        <br />
                        <a href="http://www.linux.com/archive/forums?by=412591&amp;func=searchtopics">
Other Topics                        </a>
                    </span>
                </td>

                <td class="xar-norm message">
                   <div class="xarbb-messagecontrols">
                       <div class="leftnote">
                           <span class="xar-sub">
Posted:
                                Oct 29, 2008 10:52:07 AM                           </span>
                       </div>
                       <div class="rightnote">
</div>
                       <div style="float:left;">
                           <strong class="xar-sub">
Subject:
                                <a name="1201874" href="http://www.linux.com/archive/forums/topic/3192#1201874">
                                    Re:  Fedora/RH best practices for logging from init scripts.                                </a>
                            </strong>
                        </div>
                        <div style="clear: both;"></div>
                    </div>

                    <div style="clear: left;">
                        It seems that under Fedora you are out of luck to use a different solution: [url]https://bugzilla.redhat.com/show_bug.cgi?id=151238[/url].  Under Debian you only would have to enable bootlogd and anything that goes to /dev/console would be logged automatically.                    </div>
                </td>
            </tr>

            <tr>
                <td class="xar-norm author">
                    <a href="http://www.linux.com/archive/forums/topic/3192#top">
Back to top</a>
</td>

               <td class="xar-alt">

                            <a href="http://www.linux.com/archive/roles/412591">
                                <img src="modules/xarbb/xarimages/new/icon_profile.gif" alt="Profile" />
                            </a>
                            <a href="http://www.linux.com/archive/?module=roles&amp;func=email&amp;uid=412591">
                                <img src="modules/xarbb/xarimages/new/icon_email.gif" alt="Email" />
                           </a>
                                <a href="http://">
                                    <img src="modules/xarbb/xarimages/new/icon_www.gif" alt="Website" />
                               </a>
</td>
           </tr>
</table>
</div>

<div class="xarbb-topiccontrols">

<span class="xar-sub">
    <a href="http://www.linux.com/archive/forums">
Forum Index    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/category/4181">
        Forums 
    </a>
    <span style="font-size: larger;">&#187;</span>
    <a href="http://www.linux.com/archive/forums/forum/5">
        Programming and Development   </a>
</span>

</div>



            </channel>
</rss>
