chiark / gitweb /
Merge branch 'master' of login.chiark.greenend.org.uk:public-git/inn-innduct
[inn-innduct.git] / backends / sendxbatches.in
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
13 if [ $# -lt 3 ]
14 then
15         echo "usage: $0 <sitename> <hostname> <xbatch file name>"
16         exit 1
17 fi
18
19 LOCK=${LOCKS}/LOCK.sendxbatches
20 shlock -p $$ -f ${LOCK}
21 if [ $? -ne 0 ]
22 then
23         echo Locked by `cat ${LOCK}`
24         exit 1
25 fi
26
27 trap 'rm -f ${LOCK} ; exit 1' 1 2 3 15
28 site="$1"
29 host="$2"
30 shift; shift
31
32 ctlinnd -s flush "$site"
33 if [ $? -ne 0 ]
34 then
35         echo "ctlinnd flush $site failed."
36         exit 1
37 fi
38 sleep 5
39 $NEWSBIN/innxbatch -D -v "$host" $*