<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 18, 2015 at 6:10 AM, Navneet Sinha <span dir="ltr"><<a href="mailto:nnavneetsinha1001@gmail.com" target="_blank">nnavneetsinha1001@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>I have systemd service, say xyzWarmup.service. </div><div><br></div><div>Here is the service file</div><div><br></div><div>    [Unit]</div><div>    Description=Xyz agent.</div><div>    After=fooAfter.service</div><div>    Before=fooBefore1.service</div><div>    Before=fooBefore2.service</div><div><br></div><div>    [Service]</div><div>    # During boot the xyz.sh script reads input from /dev/console.  If the user</div><div>    # hits <ESC>, it will skip waiting for xyz and abc to startup.</div><div>    Type=oneshot</div><div>    StandardInput=tty</div><div>    StandardOutput=tty</div><div>    ExecStart=/usr/bin/xyz.sh start</div><div><br></div><div>    RemainAfterExit=True</div><div>    ExecStop=/usr/bin/xyz.sh stop</div><div><br></div><div>    [Install]</div><div>    WantedBy=multi-user.target</div><div><br></div><div><br></div><div>Following is the part of xyz.sh.</div><div><br></div><div>    #! /bin/bash                                                                                                                                                                                               </div><div>    #                                                              </div><div>    ### BEGIN INIT INFO                                                                                                                                                                                         </div><div>    # Required-Stop: Post                                                                                                                                                                                       </div><div>    ### END INIT INFO                                                                                                                                                                                           </div><div><br></div><div>    XYZ=/usr/bin/Xyz</div><div>    prog="Xyz"</div><div>    lockfile=/var/lock/subsys/$prog</div><div>    msg="Completing initialization"</div><div><br></div><div>    start() {</div><div>         # Run wfw in background                                                                                                                                                                                 </div><div>        ulimit -c 0</div><div>        # wfw has a default timeout of 10 minutes - just pick a large value                                                                                                                                     </div><div>        wfw -t 3600 xyz abc >/dev/null 2>&1 &</div><div>        PID=$!</div><div><br></div><div>        # Display the message here after spawning wfw so Esc can work                                                                                                                                           </div><div>        echo -n $"$msg (press ESC to skip): " > /dev/console</div><div><br></div><div>        while [ 1 ]; do</div><div>            read -s -r -d "" -N 1 -t 0.2 CHAR || true</div><div>            if [ "$CHAR" = $'\x1B' ]; then</div><div>                kill -9 $PID 2>/dev/null</div><div>                # fall through to wait for process to exit                                                                                                                                                      </div><div>            fi</div><div><br></div><div>            STATE="`ps -p $PID -o state=`"</div><div>            if [ "$STATE" = ""  ]; then </div><div>                # has exited                                                                                                                                                                                    </div><div>                wait $PID 2>/dev/null</div><div>                if [ $? -eq 0 ]; then</div><div>                    echo "[ OK ]" </div><div>                    echo</div><div>                    exit 0</div><div>                else</div><div>                    echo "[ FAILED ]"</div><div>                    echo "This is failure"  </div><div>                                   exit 1</div><div>                fi</div><div>            fi</div><div>        done</div><div>    }</div><div> I am unable to see any echo message, after this line in code "if [ "$STATE" = ""  ];". When this script runs during boot I just this the following message coming from the script</div><div>      </div><div>     Completing initialization (press ESC to skip): </div></div></blockquote><div>One important update: ( I damn sure, now someone from you can help me out ) </div><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;line-height:19.5px"><b>Updated: This is the additional output which I see after the previous line</b></p><pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-size:13px;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;word-wrap:normal;color:rgb(34,36,38);background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:inherit"><b>[[  OK  ] Started Xyz agent.\n' </b></code></pre><div><b><span style="color:rgb(34,36,38);font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;font-size:15px;line-height:19.5px">If you carefully see, there are 2 opening square brackets( '[' ), from this it looks like that systemd is overwriting the log messages. The first "[" comes from the initscript's "[ OK ]". Can somebody explain this better ?</span> </b></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div></div><div>I don't see "[ OK ]" or "[ FAILED ]" on my screen.</div><div><br></div><div>When I was using this script as initscript in Fedora14, I used to see these messages. Once, I have shifted to systemd. I have started seeing this issue.</div><div><br></div><div>systemd version is :  systemd-201-2.fc18.9.i686 and systemd.default_standard_output=tty</div><div><br></div><div>Kindly help.</div><div>       </div><div>Thanks</div><span class=""><font color="#888888"><div>Navneet</div></font></span></div>
</blockquote></div><br></div></div>