/usr/lib/news/bin/actmerge is in inn2 2.6.0-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | #! /bin/bash
. /usr/lib/news/innshellvars
# $Id: actmerge.in 8232 2008-12-14 17:05:57Z iulius $
#
# actmerge - merge two active files
#
# usage:
# actmerge [-s] ign1 ign2 host1 host2
#
# -s - write status on stderr even if no fatal error
# ign1 - ignore file for host1
# ign2 - ignore file for host2
# host1 - 1st active file or host
# host2 - 2nd active file or host
#
# The merge of two active files are sent to stdout. The status is
# written to stderr.
# By: Landon Curt Noll chongo@toad.com (chongo was here /\../\)
#
# Copyright (c) Landon Curt Noll, 1996.
# All rights reserved.
#
# Permission to use and modify is hereby granted so long as this
# notice remains. Use at your own risk. No warranty is implied.
# preset vars
#
# Our lock file
LOCK=${LOCKS}/LOCK.actmerge
# where actsync is located
ACTSYNC=${PATHBIN}/actsync
# exit value of actsync if unable to get an active file
NOSYNC=127
# args used by actsync a fetch of an active file
FETCH="-b 0 -d 0 -g 0 -o aK -p 0 -q 12 -s 0 -t 0 -v 2"
# args used to merge two active files
MERGE="-b 0 -d 0 -g 0 -m -o aK -p 0 -q 12 -s 0 -t 0 -v 3"
# unless -q
QUIET=true
# parse args
#
if [ $# -gt 1 ]; then
if [ X"-s" = X"$1" ]; then
QUIET=
shift
fi
fi
if [ $# -ne 4 ]; then
echo "usage: $0 ign1 ign2 host1 host2" 1>&2
exit 1
fi
ign1="$1"
if [ ! -s "$ign1" ]; then
echo "$0: host1 ignore file not found or empty: $ign1" 1>&2
exit 2
fi
ign2="$2"
if [ ! -s "$ign2" ]; then
echo "$0: host2 ignore file not found or empty: $ign2" 1>&2
exit 3
fi
host1="$3"
host2="$4"
# Lock out others
#
trap 'rm -f ${LOCK}; exit 1' 0 1 2 3 15
shlock -p $$ -f ${LOCK} || {
echo "$0: Locked by `cat ${LOCK}`" 1>&2
exit 4
}
# setup
#
tmp="$TMPDIR/.merge$$"
act1="$TMPDIR/.act1$$"
act2="$TMPDIR/.act2$$"
trap "rm -f $tmp ${LOCK} $act1 $act2; exit" 0 1 2 3 15
rm -f "$tmp"
touch "$tmp"
chmod 0600 "$tmp"
rm -f "$act1"
touch "$act1"
chmod 0600 "$act1"
rm -f "$act2"
touch "$act2"
chmod 0600 "$act2"
# try to fetch the first active file
#
echo "=-= fetching $host1" >>$tmp
eval "$ACTSYNC -i $ign1 $FETCH /dev/null $host1 > $act1 2>>$tmp"
status=$?
if [ "$status" -ne 0 ]; then
# We failed on our first try, so we will trice knock 3 times after
# waiting 5 minutes.
#
for loop in 1 2 3; do
# wait 5 minutes
sleep 300
# try #1
eval "$ACTSYNC -i $ign1 $FETCH /dev/null $host1 > $act1 2>>$tmp"
status=$?
if [ "$status" -eq "$NOSYNC" ]; then
break;
fi
# try #2
eval "$ACTSYNC -i $ign1 $FETCH /dev/null $host1 > $act1 2>>$tmp"
status=$?
if [ "$status" -eq "$NOSYNC" ]; then
break;
fi
# try #3
eval "$ACTSYNC -i $ign1 $FETCH /dev/null $host1 > $act1 2>>$tmp"
status=$?
if [ "$status" -eq "$NOSYNC" ]; then
break;
fi
done
# give up
#
if [ "$status" -ne 0 ]; then
echo "=-= `date` merge $host1 $host2 exit $status" 1>&2
sed -e 's/^/ /' < "$tmp" 1>&2
exit "$status"
fi
fi
if [ ! -s "$act1" ]; then
echo "$0: host1 active file not found or empty: $act1" 1>&2
exit 5
fi
# try to fetch the second active file
#
echo "=-= fetching $host2" >>$tmp
eval "$ACTSYNC -i $ign2 $FETCH /dev/null $host2 > $act2 2>>$tmp"
status=$?
if [ "$status" -ne 0 ]; then
# We failed on our first try, so we will trice knock 3 times after
# waiting 5 minutes.
#
for loop in 1 2 3; do
# wait 5 minutes
sleep 300
# try #1
eval "$ACTSYNC -i $ign2 $FETCH /dev/null $host2 > $act2 2>>$tmp"
status=$?
if [ "$status" -eq "$NOSYNC" ]; then
break;
fi
# try #2
eval "$ACTSYNC -i $ign2 $FETCH /dev/null $host2 > $act2 2>>$tmp"
status=$?
if [ "$status" -eq "$NOSYNC" ]; then
break;
fi
# try #3
eval "$ACTSYNC -i $ign2 $FETCH /dev/null $host2 > $act2 2>>$tmp"
status=$?
if [ "$status" -eq "$NOSYNC" ]; then
break;
fi
done
# give up
#
if [ "$status" -ne 0 ]; then
echo "=-= `date` merge $host1 $host2 exit $status" 1>&2
sed -e 's/^/ /' < "$tmp" 1>&2
exit "$status"
fi
fi
if [ ! -s "$act2" ]; then
echo "$0: host2 active file not found or empty: $act2" 1>&2
exit 6
fi
# merge the 2 active files to stdout
#
echo "=-= merging $host1 and $host2" >>$tmp
eval "$ACTSYNC $MERGE $act1 $act2" 2>>$tmp
status=$?
if [ "$status" -ne 0 ]; then
echo "=-= `date` merge $host1 $host2 exit $status" 1>&2
sed -e 's/^/ /' < "$tmp" 1>&2
exit "$status"
fi
# if not -q, send status to stderr
#
if [ -z "$QUIET" ]; then
echo "=-= `date` merge $host1 $host2 successful" 1>&2
sed -e 's/^/ /' < "$tmp" 1>&2
fi
# all done
#
rm -f "${LOCK}"
exit 0
|