It should contain a sentence like : Ensure, that every script exits soon - or - use a wrapper which calls something like "nohup <foo.sh> &". OMHO.
There are no restrictions on /etc/local.d, so I don't know what the issue is you are trying to solve. Thanks, William
If a user puts in here a script which does not (immediately) exits - then all subsequent scripts aren't executed. Here's an example : n22 /etc/local.d # ls -l i915.start -rwxr--r-- 1 root root 91 Feb 10 13:44 i915.start n22 /etc/local.d # cat i915.start #!/bin/sh # cd /tmp nohup /home/tfoerste/workspace/bin/check_i915_error_state.sh & exit n22 /etc/local.d # cat /home/tfoerste/workspace/bin/check_i915_error_state.sh #!/bin/sh # # Toralf Foerster # Hamburg # Germany # set -x STATE=/sys/kernel/debug/dri/0/i915_error_state while [[ : ]] do LINES=$(wc -l $STATE | tail -n 1 | cut -f1 -d' ') if [[ $LINES -gt 1 ]]; then break fi sleep 30 done DATE=$(date +%Y%m%d-%H%M%S) FILE=/var/tmp/i915_error_state.${DATE}.txt.gz gzip -c $STATE > $FILE ls -l $FILE | mail -s "i915_error_state" tfoerste@localhost exit 0
(In reply to comment #2) > If a user puts in here a script which does not (immediately) exits - then > all subsequent scripts aren't executed. > > Here's an example : > > > n22 /etc/local.d # ls -l i915.start > -rwxr--r-- 1 root root 91 Feb 10 13:44 i915.start > > > > n22 /etc/local.d # cat i915.start > #!/bin/sh > # > > cd /tmp > nohup /home/tfoerste/workspace/bin/check_i915_error_state.sh & > > exit It looks like this exits right away, because it puts check_i915_error_state.sh in the background.
(In reply to comment #3) > It looks like this exits right away, because it puts > check_i915_error_state.sh in the background. Right - and exactly this should be mentioned in the README.
(In reply to comment #2) > If a user puts in here a script which does not (immediately) exits - then > all subsequent scripts aren't executed. I'm not sure how this would be happening since the start() function in /etc/init.d/local does not fail if one of the scripts we run fails; it just moves on to the next one. There is no intentional requirement that things run from local exit immediately. If you put something in local that takes an hour to run, we don't stop you from doing that, and the local service doesn't care about the return codes from whatever it runs, so I don't understand what you want me to put in the README.
ick - I could swear, that I didn't get a login prompt if those scripts doesn't return immediately - but now - you're right. Closing this as a brain f...
I'm reopening this bug after testing it twice. If you put the following script into /etc/local.d : #!/bin/sh # FILE=/var/lib/boinc/stderrdae.txt while [[ true ]]; do if [[ -s $FILE ]]; then cat $FILE | mail -s '$FILE' tfoerste@localhost break fi sleep 60 done exit 0 then you'll never get a login prompt, as long as that file is empty. And that's a good example, that a user shouldn't just symlink a script, isntad he has to write a wrapper for it.
Ok, now I see what you are talking about. The local service does not return until every process it is supposed to start or stop has been started or stopped. So if something doesn't return, the local service will wait forever for it to come back and you will not get a login prompt. I know that wording is confusing, but that's the idea. I will come up with a better way to put it in the README.
(In reply to comment #8) let's add a default timeout to the local init service. people shouldn't be able to bugger their boot by accident like this.
(In reply to comment #9) > (In reply to comment #8) > > let's add a default timeout to the local init service. people shouldn't be > able to bugger their boot by accident like this. What's about starting each script with "nohup ...&" and a (configurable ?) time intervall between each.
(In reply to comment #10) > (In reply to comment #9) > > (In reply to comment #8) > > > > let's add a default timeout to the local init service. people shouldn't be > > able to bugger their boot by accident like this. @vapier: What we would have to do is use the timeout command to force kill anything in local that runs for too long, and allow the timeout value to be configured. What is a good default timeout length? Would you say 60 seconds? > What's about starting each script with "nohup ...&" and a (configurable ?) > time intervall between each. I think this isn't a good way to go because we have to deal with the redirection that nohup does and I'm not sure we want to ignore sighup.
I updated the documentation as originally requested. I think that is the more user-friendly option in this case; I don't think users would want their processes to be killed because we thought they took too long. The change is in commit ceb88fc and will be part of OpenRC-0.12.
(In reply to comment #12) > I updated the documentation as originally requested. :-D