rpcbind still starts to late in systemd.

Unfortunately the trick I used here (http://forums.opensuse.org/english/other-forums/development/programming-scripting/469832-running-commands-depend-process-being-started-after-local.html) to wait for rpcbind before mounting a file server doesn’t work in 12.2 anymore.

#!/bin/sh
timeout=5

printf "\033;34;1mRunning after.local "
exec > /var/log/afterlocal.log 2>&1

date +"after.local executed on %c"

# run a command after a given process  
function runafter {
proc=$1
shift
 -x $proc ] || return 1
while ( ! /sbin/checkproc $proc ) ; do
        printf "Waiting for %s
" $proc
        sleep $timeout
done
$* 
}

LMOUNT=/usr/local/bat/lmount4

# create /tmp/.cache directory
# test -d /tmp/.cache || mkdir -m 1777 /tmp/.cache

**sleep $timeout**

# mounting fileserver
test -x $LMOUNT && runafter /sbin/rpcbind "$LMOUNT -m kamala"

I don’t know why the while loop doesn’t work while booting. It does otherwise if I kill rpcbind and run the script in a terminal. I have to brutally sleep for 5 seconds, so the loop returns immediately. But 5 seconds is about the time you need to wait for rpcind from the point where after.local gets executed in systemd. I have to use the same stupid hack under Fedora 16. If I put a lower timeout (I tried with 4 seconds), it doesn’t work.

Notice that I created an after.local log (the code in blue). Here’s the log when I use a timeout of 5 seconds:

# cat /var/log/afterlocal.log
after.local executed on Fri 12 Oct 2012 11:37:40 AM PDT
   - mounting kamala

and here’s the log with timeout=4:

# cat /var/log/afterlocal.log
after.local executed on Fri 12 Oct 2012 12:01:49 PM PDT
rpcinfo: can't contact portmapper: RPC: Remote system error - No route to host
no NFS shared resources on kamala

I tried several times. As far as I can tell, it always works with a timeout of 5 on this computer. It never worked with a shorter timeout. :frowning:

  • Please read “too late” in the subject !