View previous topic :: View next topic |
Author |
Message |
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Wed Aug 08, 2018 4:00 pm Post subject: Debug application stuck in start script ? |
|
|
Hello,
I have application which works fine when it is called from shell.
I need to be called in startup script, so I've put it in /etc/local.d
Yet, now the system hangs in boot, and I have no clue what happened , because there are no prints in terminal on boot.
Is there a way to debug what happened ?
Thanks,
ran |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Aug 08, 2018 4:24 pm Post subject: Re: Debug application stuck in start script ? |
|
|
ranran wrote: | I need to be called in startup script, so I've put it in /etc/local.d. Yet, now the system hangs in boot, and I have no clue what happened , because there are no prints in terminal on boot. |
ranran ... difficult to tell without knowing what the "application" is, or what the script contains ... you should provide both. However, it sounds like said application doesn't background itself, or your script isn't doing so, and so the controlling tty is held. You could use 'start-stop-daemon' if the former (see: 'man start-stop-daemon').
best ... khay |
|
Back to top |
|
|
ranran Tux's lil' helper
Joined: 11 Jul 2018 Posts: 75
|
Posted: Wed Aug 08, 2018 4:36 pm Post subject: |
|
|
Hi,
Thanks for the reply.
What do you mean that it "doesn't background itself", can you give more details ?
I have /etc/local.d/start.sh -> which all it has inside is:
/home/myapp start
What does it mean "doesn't background itself" ?
How can I debug what happens and where it is stuck ?
I understand that it is more "a linux question" than specific gentoo,
Thanks again,
ranran |
|
Back to top |
|
|
khayyam Watchman
Joined: 07 Jun 2012 Posts: 6227 Location: Room 101
|
Posted: Wed Aug 08, 2018 6:40 pm Post subject: |
|
|
ranran wrote: | What do you mean that it "doesn't background itself", can you give more details? |
ranran ... ummm? ... when you run a process it is attached to a TTY, or "terminal" device. This terminal is much like a pipeline and consists of stdin ("standard input"), stdout ("standard output"), and stderr ("standard error"), with taps/switches (ie, ^Z, ^C, etc) allowing the control of the process (flowing through the tty). So, when some process is passing through the tty it effectively holds the tty until the process has completed, however, process can be suspended (^Z), killed (^C), backgrounded, etc, and so the tty is returned (ie, to the shell). This allows for processes to be run as 'daemons' (ie, apache, sshd, mysql, etc), these are not started via an interactive shell as such (and so hold the tty) but by another process (ie, init, or a script run from init.d or local.d). The concept is the same however, for the script to come to completion any long running processes must run in the background as otherwise they are holding the tty. Most daemons (such as sshd, apache, etc) know to background themselves, others are not so cognisant of their place in this schema, but can generally be made to do the right thing via various means (again, see: 'man start-stop-daemon').
ranran wrote: | I have /etc/local.d/start.sh -> which all it has inside is: /home/myapp start |
That should be 'name.start' (see: /etc/local.d/README), but anyhow, I hate having to guess ... what is 'myapp'? If this is some x11 app then it's going to expect USER, DISPLAY, and XAUTHORITY, which won't be available in the env where rc is running. Otherwise, if it's a unix like 'command', or daemon, then '/home/myapp start &' should suffice to background ... though start-stop-daemon is probably the better option.
ranran wrote: | How can I debug what happens and where it is stuck? |
For 'myapp' then 'strace' (dev-util/strace) should give some idea of what it's doing, and what it expects, when run from a shell.
best ... khay |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|