Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / bsd / am-utils / dist / scripts / wait4amd.in
blob5e6c33a579c4b21b86b6a60c3577f83748ec4157
1 #!/bin/sh
2 # wait for amd to start up and then execute program
3 # usage: wait4amd <hostname> [<command> [args ...]]
4 # If only hostname is supplied, command defaults to rsh $hostname
6 # Package: am-utils-6.x
7 # Author: Erez Zadok <ezk@cs.columbia.edu>
9 #set -x
11 if [ "X$1" = "X" ]; then
12 echo "Usage: wait4amd <hostname> [<command> [args ...]]"
13 exit 1
14 else
15 hostname=$1
16 shift
19 # set path
20 prefix=@prefix@
21 exec_prefix=@exec_prefix@
22 PATH=@sbindir@:@bindir@:${PATH}
23 export PATH
25 while true
27 amq -h $hostname > /dev/null 2>&1
28 if [ $? != 0 ]
29 then
30 # failed
31 echo "Amd not up. Sleeping..."
32 sleep 5;
33 else
34 echo "Amd is active on host $hostname!"
35 cmd=$*
36 if [ -z "${cmd}" ]
37 then
38 cmd="rlogin $hostname"
40 echo "Running: $cmd"
41 $cmd
42 echo "Sleep 1 second"
43 sleep 1
45 done