[systemd-devel] echo message not coming on terminal with systemd
Navneet Sinha
nnavneetsinha1001 at gmail.com
Mon Dec 21 06:40:23 PST 2015
One more very important observation.
On Fri, Dec 18, 2015 at 6:10 AM, Navneet Sinha <nnavneetsinha1001 at gmail.com>
wrote:
> I have systemd service, say xyzWarmup.service.
>
> Here is the service file
>
> [Unit]
> Description=Xyz agent.
> After=fooAfter.service
> Before=fooBefore1.service
> Before=fooBefore2.service
>
> [Service]
> # During boot the xyz.sh script reads input from /dev/console. If the
> user
> # hits <ESC>, it will skip waiting for xyz and abc to startup.
> Type=oneshot
> StandardInput=tty
> StandardOutput=tty
> ExecStart=/usr/bin/xyz.sh start
>
> RemainAfterExit=True
> ExecStop=/usr/bin/xyz.sh stop
>
> [Install]
> WantedBy=multi-user.target
>
>
> Following is the part of xyz.sh.
>
> #! /bin/bash
>
>
> #
> ### BEGIN INIT INFO
>
>
> # Required-Stop: Post
>
>
> ### END INIT INFO
>
>
>
> XYZ=/usr/bin/Xyz
> prog="Xyz"
> lockfile=/var/lock/subsys/$prog
> msg="Completing initialization"
>
> start() {
> # Run wfw in background
>
>
> ulimit -c 0
> # wfw has a default timeout of 10 minutes - just pick a large
> value
>
> wfw -t 3600 xyz abc >/dev/null 2>&1 &
>
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.
Does anybody has some clue on why echo messages gets redirected to abc
process's STDOUT ?
> PID=$!
>
> # Display the message here after spawning wfw so Esc can work
>
>
> echo -n $"$msg (press ESC to skip): " > /dev/console
>
> while [ 1 ]; do
> read -s -r -d "" -N 1 -t 0.2 CHAR || true
> if [ "$CHAR" = $'\x1B' ]; then
> kill -9 $PID 2>/dev/null
> # fall through to wait for process to exit
>
>
> fi
>
> STATE="`ps -p $PID -o state=`"
> if [ "$STATE" = "" ]; then
> # has exited
>
>
> wait $PID 2>/dev/null
> if [ $? -eq 0 ]; then
> echo "[ OK ]"
> echo
> exit 0
> else
> echo "[ FAILED ]"
> echo "This is failure"
> exit 1
> fi
> fi
> done
> }
> 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
>
> Completing initialization (press ESC to skip):
>
> I don't see "[ OK ]" or "[ FAILED ]" on my screen.
>
> 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.
>
> systemd version is : systemd-201-2.fc18.9.i686 and
> systemd.default_standard_output=tty
>
> Kindly help.
>
> Thanks
> Navneet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20151221/77d24dce/attachment.html>
More information about the systemd-devel
mailing list