I wrote a tiny program today called /dcs/etc/run-when-available.  Usage
is like:

/dcs/etc/run-when-available /soe/some-package/bin/some-executable arg1
arg2 ... argn

You can run it with no arguments to get usage.

This came up from a discussion of how automounting is an improvement, in
a way, over static mounting (because of no deadlock situations on
reboots), but that automounting can sometimes lead to rc scripts not
getting run.  run-when-available is intended to remedy that situation,
by latching onto a program, and attempting to stat it again and again,
and only execv'ing it when stat succeeds (IE, the file is present in the

You will mostly likely want to run it as:

/dcs/etc/daemon /dcs/etc/run-when-available prog arg arg

...instead of as:

/dcs/etc/run-when-available prog arg arg &

...because on Tru64 (at least in the past; this may have changed), if
you background a program from an rc script, then Tru64 will wait for
that program to finish before leaving the runlevel from which that
program was started.  /dcs/etc/daemon persuades the startup system that
the program has exited already.

run-when-available has the following advantages over nanny:

1) run-when-available will only delay for, on average, 30 seconds.=20
nanny will delay for, on average, 30 minutes.

2) In the presence of an NFS timeout, run-when-available will only start
one process.  Nanny will start another process every hour, and each one
will get stuck on the NFS mount until NFS recovers.  I've seen this

It is my belief that this program allows one to design better startup
procedures, without arbitrarily dictating what programs have to run on
what servers.

I only tested this on RHEL, but it compiled easily on the others, and
doesn't use any esoteric features.

I suggest that we add-local-exe this program as needed.

The program itself is just:
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

/* because nanny doesn't give as good uptime :) */

int main(int argc,char *argv[])
	int stat_result=-1;
	struct stat stat_buf;
	if (argc == 1)
		fprintf(stderr,"Usage: %s command arg1 arg2 ... argn\n",argv[0]);
			stat_result = stat(argv[1],&stat_buf);
			if (stat_result == 0)
	perror("exec failed\n");