[systemd-devel] if StandardInput is set, echo messages from script doesn't show up on terminal.

Navneet Sinha nnavneetsinha1001 at gmail.com
Mon Jan 18 09:35:40 PST 2016


Any updates ?

On Fri, Jan 15, 2016 at 11:16 AM, Navneet Sinha <nnavneetsinha1001 at gmail.com
> wrote:

> I have systemd service, say foo.service.
>
> *Service file*
>
>   [Unit]
>   Description=Foo agent.
>   After=fooAfter.service
>   Before=fooBefore1.service
>   Before=fooBefore2.service
>
>   [Service]
>   # During boot the foo.sh script reads input from /dev/console.  If the
> user
>   # hits <ESC>, it will skip waiting for foo and foo2 to startup.
>   Type=oneshot
>   StandardInput=tty
>   StandardOutput=tty
>   ExecStart=/usr/bin/foo.sh start
>
>   RemainAfterExit=True
>   ExecStop=/usr/bin/foo.sh stop
>
>   [Install]
>   WantedBy=multi-user.target
>
>
> *start function from foo.sh*
>
> start() {
>
>     echo -n "This is a fake systemd service"
>     success
>     echo
>     exit 0
> }
>
> During boot up this service file is being executed
> Following is what I am seeing :
>
> "2016-01-14 20:24:39.693603 11760 pexpect              2 c:abc3#1 received:*
> 'This is a fake s'*
>
> Instead I expected *"This is a fake systemd service"* and in next line *"[
> OK ]"*
>
> *systemd version *is :  systemd-201-2.fc18.9.i686
>
> *systemd configuration* for the system, I am using is :
>
> systemd.default_standard_output=tty
> systemd.show_status=0
>
>
> On further debugging, what I see if I add just a "sleep 1" after echo.
> Missing echo Messages starts showing up during boot up OR if I remove
> "StandardInput" attribute from the service file.
>
> So, the issue I am suspecting has something to do with this process
> becoming the controlling process for the terminal( as StandardInput is set
> ).
>
> *start function from foo.sh after adding "sleep 1"*
>
> start() {
>
>     echo -n "This is a fake systemd service"
>     success
>     echo
>     *sleep 1*
>     exit 0
> }
>
> Can somebody explain this  and also suggest a better solution, if there is.
>
> Thanks
> Navneet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20160118/8342808d/attachment-0001.html>


More information about the systemd-devel mailing list