<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hello Francisco,</DIV>
<DIV>Thanks for your answer, I’ve tried to include $mountkernfs in the required 
modules of the script, but it didn’t work.</DIV>
<DIV>I’m not sure why the “touch” command doesn’t work because i set remountrw 
just before the command but the file is not created.</DIV>
<DIV> </DIV>
<DIV>I’ve also tried using another directory that is not tmpfs but the result is 
the same, it works when I start it manually but not after rebooting</DIV>
<DIV> </DIV>
<DIV>(I’ve set #!bin/bash at the beggining of the script)</DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=alidhaey@gmail.com 
href="mailto:alidhaey@gmail.com">Francisco José Sánchez</A> </DIV>
<DIV><B>Sent:</B> Tuesday, March 27, 2012 10:08 PM</DIV>
<DIV><B>To:</B> <A title=acastelli@keonn.com 
href="mailto:acastelli@keonn.com">Toni Castelli</A> </DIV>
<DIV><B>Cc:</B> <A title=voyage-linux@voyage.hk 
href="mailto:voyage-linux@voyage.hk">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 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">Ok 
Toni, 
<DIV> </DIV>
<DIV>I think that the problem is the moment executed script. Question ¿is 
mounted /var/log? </DIV>
<DIV> </DIV>
<DIV>For depuration include into script a mount command before touch file 
log.</DIV>
<DIV> </DIV>
<DIV>PD: normaly, /var/log is mount tmpfs (/etc/init.d/mountkernfs). Is the 
execution your script before or after mountkernfs?</DIV>
<DIV> </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 
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>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-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
  <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-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">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>
<DIV> </DIV></DIV></DIV></DIV></DIV></BODY></HTML>