1#! /bin/sh
2# fixscript will replace this line with code to load innshellvars
3
4# $Id: sendxbatches.in 2674 1999-11-15 06:28:29Z rra $
5# By petri@ibr.cs.tu-bs.de with mods by libove@jerry.alf.dec.com
6#
7#  Script to send xbatches for a site, wrapped around innxbatch
8#  Invocation: sendxbatches <sitename> <hostname> <xbatch file name> ...
9#
10##  TODO: - we should check the amount of queued batches for the site,
11##          to prevent disk overflow due to unreachable sites.
12
13if [ $# -lt 3 ]
14then
15	echo "usage: $0 <sitename> <hostname> <xbatch file name>"
16	exit 1
17fi
18
19LOCK=${LOCKS}/LOCK.sendxbatches
20shlock -p $$ -f ${LOCK}
21if [ $? -ne 0 ]
22then
23	echo Locked by `cat ${LOCK}`
24	exit 1
25fi
26
27trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
28site="$1"
29host="$2"
30shift; shift
31
32ctlinnd -s flush "$site"
33if [ $? -ne 0 ]
34then
35	echo "ctlinnd flush $site failed."
36	exit 1
37fi
38sleep 5
39$NEWSBIN/innxbatch -D -v "$host" $*
40