On Wed, Nov 17, 2021 at 10:29 PM Arnout Vandecappelle <arnout@mind.be> wrote:


On 17/11/2021 13:48, José Pekkarinen wrote:
>
>
> On Tue, Nov 16, 2021 at 4:25 PM Thomas Petazzoni <thomas.petazzoni@bootlin.com
> <mailto:thomas.petazzoni@bootlin.com>> wrote:
>
>     Hello José,
>
>     On Tue, 16 Nov 2021 14:08:02 +0200
>     José Pekkarinen <jose.pekkarinen@unikie.com
>     <mailto:jose.pekkarinen@unikie.com>> wrote:
>
>      > Any hint what would be the right place in buildroot
>      >
>      > userspace to put an script after the init process is over?
>
>     The init process by itself is never over, it continues to run until you
>     reboot your system.
>
>     Could you clarify your question? You want a service to be started after
>     all other services?
>
>
>     Hi,
>
>     I want to run a script after the TTYs are up and running.
>
> Currently I run the script as S99myscript, and put a call in the
> start, and it fails. If I later logging as root and manually run the
> S99myscript start, it runs well.

  The ttys are started immediately after the last script in /etc/init.d has
finished, so it's unlikely a problem due to sequencing. More likely, the
difference you observe is due to the difference in environment between an
interactive login and when the init script is executed directly by init.

  To debug your init script, you can start it with

#! /bin/sh -x

This will echo each command before it is executed, which will help to determine
where it fails.

Thanks for the hints, the problem was actually in the script
since it referenced some files relatively, and for the init script it requires
absolute path. Now it works.

Best regards.

José.