<div dir="ltr">One more very important observation. <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:0 0 0 .8ex;border-left:1px #ccc 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></blockquote><div><font color="#0000ff">Let me tell you here abc and xyz are waiting to get warmed up. As soon as , abc gets warmed up I start loosing echo messages. when I look at /proc/<PID of abc>/fd, I see that STDOUT for this is pointing to /dev/null. From here, I think that some how when abc process starts all echo messages gets redirected to /dev/null. </font></div><div><font color="#0000ff">Does anybody has some clue on why echo messages gets redirected to abc process's STDOUT ?</font></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><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><br></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="HOEnZb"><font color="#888888"><div>Navneet</div></font></span></div>
</blockquote></div><br></div></div>