Ok Toni,<div><br></div><div>I think that the problem is the moment executed script. Question ¿is mounted /var/log? </div><div><br></div><div>For depuration include into script a mount command before touch file log.</div><div>
<br></div><div>PD: normaly, /var/log is mount tmpfs (/etc/init.d/mountkernfs). Is the execution your script before or after mountkernfs?</div><div><br></div><div>Best regards.</div><div><br><br><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>Yes, sorry thats a typo, I actually use what you wrote 
logFile=/var/log/test.log </div>
<div> </div>
<div>When I start the script manually “/etc/init.d/script start” it runs my 
program ok and generates the proper log file, the problem is that after 
rebooting, my program starts automatically but the no log file is created.</div>
<div>   </div>
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal">
<div style="FONT:10pt tahoma">
<div> </div>
<div style="BACKGROUND:#f5f5f5">
<div><b>From:</b> <a title="alidhaey@gmail.com" href="mailto:alidhaey@gmail.com" target="_blank">Francisco José Sánchez</a> </div>
<div><b>Sent:</b> Tuesday, March 27, 2012 6:13 PM</div>
<div><b>To:</b> <a title="acastelli@keonn.com" href="mailto:acastelli@keonn.com" target="_blank">Toni Castelli</a> </div>
<div><b>Cc:</b> <a title="voyage-linux@voyage.hk" href="mailto:voyage-linux@voyage.hk" target="_blank">voyage-linux@voyage.hk</a> </div>
<div><b>Subject:</b> Re: [Voyage-linux] log the stdout of a process started by 
start-stop-daemon</div></div></div>
<div> </div></div><div><div class="h5">
<div style="font-size:small;font-style:normal;text-decoration:none;font-family:'Calibri';display:inline;font-weight:normal">Hello 
Toni, 
<div> </div>
<div>
<div class="gmail_quote">2012/3/27 Toni Castelli <span dir="ltr"><<a href="mailto:acastelli@keonn.com" target="_blank">acastelli@keonn.com</a>></span><br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
  <div dir="ltr">
  <div dir="ltr">
  <div style="FONT-FAMILY:'Calibri';FONT-SIZE:12pt">
  <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> </div>
<div>is wrong variable assignation (really is a error in your script o is a 
error the transcription email?)</div>
<div> </div></div></div>
<blockquote style="BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0px;MARGIN:0px 0px 0px 40px;PADDING-LEFT:0px;PADDING-RIGHT:0px;BORDER-TOP:medium none;BORDER-RIGHT:medium none;PADDING-TOP:0px">
  <div>
  <div class="gmail_quote">
  <div>logFile=/var/log/test.log</div></div></div></blockquote>
<div>
<div class="gmail_quote">
<div> </div>
<div> </div>
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
  <div dir="ltr">
  <div dir="ltr">
  <div style="FONT-FAMILY:'Calibri';FONT-SIZE:12pt">
  <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> </div></div></div>
<blockquote style="BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0px;MARGIN:0px 0px 0px 40px;PADDING-LEFT:0px;PADDING-RIGHT:0px;BORDER-TOP:medium none;BORDER-RIGHT:medium none;PADDING-TOP:0px">
  <div>
  <div class="gmail_quote">
  <div>if [ -f $logFile ]; then</div></div></div>
  <blockquote style="BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0px;MARGIN:0px 0px 0px 40px;PADDING-LEFT:0px;PADDING-RIGHT:0px;BORDER-TOP:medium none;BORDER-RIGHT:medium none;PADDING-TOP:0px">
    <div>
    <div class="gmail_quote">
    <div><code true></div></div></div></blockquote>else 
  <div>
  <blockquote style="BORDER-BOTTOM:medium none;BORDER-LEFT:medium none;PADDING-BOTTOM:0px;MARGIN:0px 0px 0px 40px;PADDING-LEFT:0px;PADDING-RIGHT:0px;BORDER-TOP:medium none;BORDER-RIGHT:medium none;PADDING-TOP:0px">
    <div><code false></div></blockquote></div>
  <div>fi</div>
  <div> </div>
  <div>or this other example</div>
  <div> </div>
  <div>
  <div>
  <div class="gmail_quote">
  <div>if [ ! -f $logFile ]; then</div></div></div>
  <blockquote style="BORDER-BOTTOM-STYLE:none;PADDING-BOTTOM:0px;MARGIN:0px 0px 0px 40px;BORDER-LEFT-STYLE:none;PADDING-LEFT:0px;PADDING-RIGHT:0px;BORDER-TOP-STYLE:none;BORDER-RIGHT-STYLE:none;PADDING-TOP:0px">
    <div>
    <div class="gmail_quote">
    <div><code false condition></div></div></div></blockquote>else 
  <div>
  <blockquote style="BORDER-BOTTOM-STYLE:none;PADDING-BOTTOM:0px;MARGIN:0px 0px 0px 40px;BORDER-LEFT-STYLE:none;PADDING-LEFT:0px;PADDING-RIGHT:0px;BORDER-TOP-STYLE:none;BORDER-RIGHT-STYLE:none;PADDING-TOP:0px">
    <div><code true condition></div></blockquote></div>
  <div>fi</div></div>
  <div> </div></blockquote>
<div> </div>
<div>but I don't know what yo want to do.</div>
<div> </div>
<div>
<div> </div>
<div>
<div class="gmail_quote">
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
  <div dir="ltr">
  <div dir="ltr">
  <div style="FONT-FAMILY:'Calibri';FONT-SIZE:12pt">
  <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> </div>
<div>best regards.</div>
<div> </div>
<div>PD: Excuse me English language, but spanish user ;-)</div>
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote"><br>_______________________________________________<br>Voyage-linux 
  mailing list<br><a href="mailto:Voyage-linux@list.voyage.hk" target="_blank">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>
<div> </div></div></div></div></div></div></div></div></div>
<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>