OPENSUSE 12.2 and /etc/init.d/after/local = not runing ...Help me

OpenSuse12.2
/etc/init.d/after.local not runing after all…

Please help me.

Serg

On 10/31/2012 08:06 AM, skoltogyan wrote:
>
> /etc/init.d/after.local not runing after all…

you say “after all” which means (to me) there is more to this
story…that is

  • did it used to run ok, but not now? if so, what changed? (YaST or
    zypper update, system version change, distro version change, contents of
    after.local changed, etc etc etc)

  • if it ran ok on 12.1 or before but not now: explain in what version it
    ran ok as well as, was that version using systemv or systemd

  • did it never run ok but you thought it did? explain

  • might you please include a copy of your after.local as well as a
    description of what you intended it to do, please…


dd

Either convert your script to systemd or switch your system into using sysvinit instead of systemd.

# systemctl enable after-local.service

On 2012-10-31 10:06, hcvv wrote:
>
> Either convert your script to systemd or switch your system into using
> sysvinit instead of systemd.

Or use the hack published by … to make it work again. Oh, no, that was for boot.local.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” (Minas Tirith))

On 10/31/2012 06:11 AM, Carlos E. R. wrote:
> On 2012-10-31 10:06, hcvv wrote:
>>
>> Either convert your script to systemd or switch your system into using
>> sysvinit instead of systemd.
>
> Or use the hack published by … to make it work again. Oh, no, that was for boot.local.

With systemd, there is no concept of “after” as there is with systemv. As a
result, it is impossible to write a service that is guaranteed to run after
everything else is finished. There is a script written by James McDaniel and
available at http://forums.opensuse.org/blogs/comments/comment549.html. It will
run after everything else is started, which is quite a different matter, but it
might do what you want.

There was an extensive discussion of this issue on the openSUSE Factory mailing
list and the developers are aware of the problem. This issue will be addressed
in 12.3.

Before applying this command, follow the link given by @lwfinger to get the script. Sorry.

Not exactly. It will run at some point, but not necessarily when you expect. See this thread: http://forums.opensuse.org/english/other-forums/development/programming-scripting/469832-running-commands-depend-process-being-started-after-local.html#post2418865

Unfortunately the “runafter” trick which worked under 12.1 doesn’t seem to help under 12.2. I have to enforce a delay of 5 seconds to wait for the portmapper to start in order to be able to mount nfs shares. Here’s my after.local:

#!/bin/sh
timeout=5
fileserver=spock

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

**sleep $timeout**

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

Notice the code in blue to log the output of this script in /var/log/afterlocal.log.

Do you mean “idle state”?