All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] /etc/init.d init script question
@ 2019-01-13 22:57 Enoch W.
  2019-01-16 16:00 ` Carlos Santos
  0 siblings, 1 reply; 3+ messages in thread
From: Enoch W. @ 2019-01-13 22:57 UTC (permalink / raw)
  To: buildroot

Hi,


I'm using a recent buildroot tag 2018.11 (651).


Can anyone suggest how to debug a python script that starts well from a command line:


# /etc/init.d/S53myscript start
Starting myscript: OK


but fails to start on boot via /etc/init.d/rcS


It's a python script that is launched as follows:


printf "Starting $DAEMON: "
start-stop-daemon -S -b -m -q -p "$PIDFILE" -x "/usr/bin/python" -- "/root/myscript.py"


Since the $PIDFILE is well created rcS must have ended well and it's my python script to blame, but how can I see what exception it throws...


Thanks!


Enoch.


PS1. I've tried adding a long sleep in case "something" isn't ready.

PS2. How can one simulate /etc/init.d/rcS environment ...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190113/c65af677/attachment.html>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] /etc/init.d init script question
  2019-01-13 22:57 [Buildroot] /etc/init.d init script question Enoch W.
@ 2019-01-16 16:00 ` Carlos Santos
  2019-01-16 19:04   ` Enoch W.
  0 siblings, 1 reply; 3+ messages in thread
From: Carlos Santos @ 2019-01-16 16:00 UTC (permalink / raw)
  To: buildroot

> From: "Enoch W." <ixew@hotmail.com>
> To: "buildroot" <buildroot@busybox.net>
> Sent: Domingo, 13 de janeiro de 2019 20:57:48
> Subject: [Buildroot] /etc/init.d init script question

> Hi,

> I'm using a recent buildroot tag 2018.11 (651).

> Can anyone suggest how to debug a python script that starts well from a command
> line:

> # /etc/init.d/S53myscript start
> Starting myscript: OK

> but fails to start on boot via /etc/init.d/rcS

> It's a python script that is launched as follows:

> printf "Starting $DAEMON: "
> start-stop-daemon -S -b -m -q -p "$PIDFILE" -x "/usr/bin/python" --
> "/root/myscript.py"

> Since the $PIDFILE is well created rcS must have ended well and it's my python
> script to blame, but how can I see what exception it throws...

I suspect that your script fails because it needs something that is
initialized later.

> PS1. I've tried adding a long sleep in case "something" isn't ready.

> PS2. How can one simulate /etc/init.d/rcS environment ...

Init scripts run with stdin redirected to /dev/null so run it with

    # /etc/init.d/S53myscript start < /dev/null

-- 
Carlos Santos (Casantos) - DATACOM, P&D
?Marched towards the enemy, spear upright, armed with the certainty
that only the ignorant can have.? ? Epitaph of a volunteer

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Buildroot] /etc/init.d init script question
  2019-01-16 16:00 ` Carlos Santos
@ 2019-01-16 19:04   ` Enoch W.
  0 siblings, 0 replies; 3+ messages in thread
From: Enoch W. @ 2019-01-16 19:04 UTC (permalink / raw)
  To: buildroot

Thanks, I solved my problem, I don't know if to call it a busybox deficiency or not:

/etc/init.d/rcS does not work with my root environment, so I had to help it through the init.d/ script:
myenv.sh is just a series of variable exports.

    printf "Starting $DAEMON: "
    . /etc/profile.d/myenv.sh
    start-stop-daemon -S -b -m -q -p "$PIDFILE" -x "/usr/bin/python" -- "/root/myscript.py"

Obviously, when I launched the daemon through a regular terminal session it had the full root environment, hence it behaved normally.

I suggest to mention that in the buildroot manual since /etc/init.d/rcS does not display any error message...


On 1/16/19 6:00 PM, Carlos Santos wrote:

From: "Enoch W." <ixew@hotmail.com><mailto:ixew@hotmail.com>
To: "buildroot" <buildroot@busybox.net><mailto:buildroot@busybox.net>
Sent: Domingo, 13 de janeiro de 2019 20:57:48
Subject: [Buildroot] /etc/init.d init script question





Hi,





I'm using a recent buildroot tag 2018.11 (651).





Can anyone suggest how to debug a python script that starts well from a command
line:





# /etc/init.d/S53myscript start
Starting myscript: OK





but fails to start on boot via /etc/init.d/rcS





It's a python script that is launched as follows:





printf "Starting $DAEMON: "
start-stop-daemon -S -b -m -q -p "$PIDFILE" -x "/usr/bin/python" --
"/root/myscript.py"





Since the $PIDFILE is well created rcS must have ended well and it's my python
script to blame, but how can I see what exception it throws...



I suspect that your script fails because it needs something that is
initialized later.



PS1. I've tried adding a long sleep in case "something" isn't ready.





PS2. How can one simulate /etc/init.d/rcS environment ...



Init scripts run with stdin redirected to /dev/null so run it with

    # /etc/init.d/S53myscript start < /dev/null



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20190116/f60f43c6/attachment-0001.html>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-16 19:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 22:57 [Buildroot] /etc/init.d init script question Enoch W.
2019-01-16 16:00 ` Carlos Santos
2019-01-16 19:04   ` Enoch W.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.