Hello Toni,<div><br></div><div><div class="gmail_quote">2012/3/27 Toni Castelli <span dir="ltr"><<a href="mailto:acastelli@keonn.com">acastelli@keonn.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">
<div dir="ltr">
<div style="font-size:12pt;font-family:'Calibri'">
<div>Hello, I’m having some trouble trying to log the stdout and the 
stderror  generated by an application when it is started by an init.d 
script.</div>
<div> </div>
<div>What im trying to run is something like this:</div>
<div> </div>
<div>$logFile=/var/log/test.log</div></div></div></div></blockquote><div><br></div><div>is wrong variable assignation (really is a error in your script o is a error the transcription email?)</div><div><br></div></div></div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div class="gmail_quote"><div>logFile=/var/log/test.log</div></div></div></blockquote><div><div class="gmail_quote"><div><br></div><div><br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-size:12pt;font-family:'Calibri'">
<div> </div>
<div>if [ ! "$logFile" == "" ]; then</div>
<div>               
touch $logFile || exit 2</div>
<div>               
start-stop-daemon --start --make-pidfile  --pidfile $PIDFILE  --exec 
$DAEMON -- $DAEMON_ARGS  >> $logFile 2>&1 &</div>
<div>else ....</div>
<div> </div></div></div></div></blockquote><div>when you verify exists a file, use param -f . Example</div><div><br></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div class="gmail_quote">
<div>if [ -f $logFile ]; then</div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div class="gmail_quote"><div><code true></div></div></div></blockquote>else<div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><code false></div></blockquote></div><div>fi</div><div><br></div><div>or this other example</div><div><br></div><div><div><div class="gmail_quote"><div>if [ ! -f $logFile ]; then</div></div></div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
<div><div class="gmail_quote"><div><code false condition></div></div></div></blockquote>else<div><blockquote style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:40px;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px">
<div><code true condition></div></blockquote></div><div>fi</div></div><div><br></div></blockquote><div><br></div><div>but I don't know what yo want to do.</div><div><br></div><div><br><div><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-size:12pt;font-family:'Calibri'">
<div>when I try to run the script from bash it works perfectly, but when it runs 
after a reboot, the log file isn’t generated. I’m suspecting it could be a 
matter of mounting the file system after starting my script, but I’ve checked 
the execution number and its the last one it shares the number with some other 
processes). Anyone can guess what’s wrong with the 
code?</div></div></div></div></blockquote><div><br></div><div>best regards.</div><div> </div><div>PD: Excuse me English language, but spanish user ;-)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>_______________________________________________<br>
Voyage-linux mailing list<br>
<a href="mailto:Voyage-linux@list.voyage.hk">Voyage-linux@list.voyage.hk</a><br>
<a href="http://list.voyage.hk/mailman/listinfo/voyage-linux" target="_blank">http://list.voyage.hk/mailman/listinfo/voyage-linux</a><br>
<br></blockquote></div><br></div></div>