/usr/lib/news/bin/actsyncd is in inn2 2.5.3-3ubuntu1.
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 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | #! /bin/bash
. /usr/lib/news/innshellvars
# $Id: actsyncd.in 8279 2009-01-08 20:26:26Z iulius $
#
# actsyncd - actsync daemon
#
# usage:
# actsyncd config_file [debug_level [debug_outfmt]]
#
# config_file name of file used to determine how to run actsync
# debug_level force no action and use -v debug_level
# debug_outfmt change -o a1 output to -o debug_outfmt for debug
# By: Landon Curt Noll chongo@toad.com (chongo was here /\../\)
#
# Copyright (c) Landon Curt Noll, 1993.
# 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.actsyncd"
# where actsync is located
ACTSYNC="${PATHBIN}/actsync"
# exit value of actsync if unable to get an active file
NOSYNC=127
# parse args
#
if [ $# -gt 1 ]; then
case $1 in
-x|-r) shift ;; # no longer relevant
esac
fi
case $# in
1) cfg="$1"; DEBUG=; DEBUG_FMT=; ;;
2) cfg="$1"; DEBUG="$2"; DEBUG_FMT=; ;;
3) cfg="$1"; DEBUG="$2"; DEBUG_FMT="$3"; ;;
*) echo "usage: $0 config_file [debug_level [debug_outfmt]]" 1>&2;
exit 1 ;;
esac
if [ ! -s "$cfg" ]; then
echo "$0: config_file not found or empty: $ign" 1>&2
exit 2
fi
# parse config_file
#
host="`sed -n -e 's/^host=[ ]*//p' $cfg | tail -n 1`"
if [ -z "$host" ]; then
echo "$0: no host specified in $cfg" 1>&2
exit 3
fi
flags="`sed -n -e 's/^flags=[ ]*//p' $cfg | tail -n 1`"
if [ -z "$flags" ]; then
echo "$0: no flags specified in $cfg" 1>&2
exit 4
fi
ign="`sed -n -e 's/^ignore_file=[ ]*//p' $cfg | tail -n 1`"
if [ -z "$ign" ]; then
echo "$0: no ignore file specified in $cfg" 1>&2
exit 5
fi
ftp="`sed -n -e 's/^ftppath=[ ]*//p' $cfg | tail -n 1`"
spool="`sed -n -e 's/^spool=[ ]*//p' $cfg | tail -n 1`"
if [ -z "$spool" ]; then
spool=$SPOOL
#echo "$0: no spool directory specified in $cfg" 1>&2
#exit 6
fi
if [ ! -f "$ign" ]; then
ign="${PATHETC}/$ign"
fi
if [ ! -s "$ign" ]; then
echo "$0: ignore_file not found or empty: $ign" 1>&2
exit 7
fi
# force -o c mode (overrides any -o argument in the command line)
#
if [ -z "$DEBUG" ]; then
# standard actsyncd output mode
flags="$flags -o c"
# DEBUG processing, if debug_level was given
#
else
if [ ! -z "$ftp" ]; then
echo "$0: cannot use DEBUG mode with ftp (yet)" >&2
exit 88;
fi
# force -v level as needed
flags="$flags -v $DEBUG"
# force -o level but reject -o x modes
if [ ! -z "$DEBUG_FMT" ]; then
case "$DEBUG_FMT" in
x*) echo "$0: do not use any of the -o x debug_outfmt modes!" 1>&2;
exit 8 ;;
*) flags="$flags -o $DEBUG_FMT" ;;
esac
fi
# execute actsync directly
echo "DEBUG: will execute $ACTSYNC -i $ign $flags $host" 1>&2
eval "$ACTSYNC -i $ign $flags $host"
status="$?"
echo "DEBUG: exit status $status" 1>&2
exit "$status"
fi
# Lock out others
#
shlock -p $$ -f "${LOCK}" || {
echo "$0: Locked by `cat '${LOCK}'`" 1>&2
exit 9
}
# setup
#
origdir=`pwd`
workdir="${TMPDIR}/actsyncd"
ctlinndcmds="cc_commands"
out="sync.msg"
cleanup="$SED -e 's/^/ /' < $out; cd ${origdir}; rm -rf '$workdir' '$LOCK'"
trap "eval $cleanup; exit 123" 1 2 3 15
set -e
rm -rf "$workdir"
mkdir "$workdir"
cd "$workdir"
set +e
rm -f "$out"
touch "$out"
chmod 0644 "$out"
# try to sync
#
# Try to sync off of the host. If unable to connect/sync then retry
# up to 9 more times waiting 6 minutes between each try.
#
echo "=-= `date` for $host" >>$out 2>&1
for loop in 1 2 3 4 5 6 7 8 9 10; do
# get the active file to compare against
status=0
case $host in
/*) cp $host active; status=$? ;;
.*) cp $origdir/$host active; status=$? ;;
*)
if [ -z "$ftp" ]; then
port=`expr "$host" : '.*:\(.*\)'`
if [ -n "$port" ]; then
port="-p $port"
host=`expr "$host" : '\(.*\):.*'`
fi
echo "getlist -h $host $port" >>$out
if getlist -h $host $port > active 2>>$out; then
:
else
status=$NOSYNC
fi
else
echo "$GETFTP ftp://$host/$ftp" >>$out
$GETFTP ftp://$host/$ftp >>$out 2>&1
status=$?
if [ "$status" -ne 0 ]; then
status=$NOSYNC
else
case "$ftp" in
*.gz)
echo "$GZIP -d active" >>$out
if $GZIP -d active >>$out 2>&1; then
:
else
status=1
fi
;;
*.Z)
echo "$UNCOMPRESS active" >>$out
if $UNCOMPRESS active >>$out 2>&1; then
:
else
status=1
fi
;;
esac
fi
fi
;;
esac
if [ "$status" -ne "$NOSYNC" ]; then
# detect bad status
#
if [ "$status" -ne 0 ]; then
echo "FATAL: `date` for $host exit $status" >>$out
eval $cleanup
exit "$status"
fi
echo "$ACTSYNC -i $ign $flags ./active" >>$out
eval "$ACTSYNC -i $ign $flags ./active >$ctlinndcmds 2>>$out"
if [ $? -ne 0 ]; then
echo "FATAL: `date` for $host actsync balked" >>$out
eval $cleanup
exit $?
fi
if [ ! -s $ctlinndcmds ]; then
echo "No changes need to be made" >>$out
else
echo "=-= `date` for $host, updating active" >>$out
echo "mod-active $ctlinndcmds" >>$out
mod-active $ctlinndcmds >>$out 2>&1
if [ $? -ne 0 ]; then
echo "FATAL: `date` for $host mod-active FAILED" >>$out
eval $cleanup
exit 1
fi
fi
# normal exit - all done
#
echo "=-= `date` for $host, end" >>$out
eval $cleanup
exit 0
fi
# failed to get the remote active file
echo "=-= `date` for $host failed to connect/sync, retrying" >>$out
# wait 6 minutes
#
sleep 360
done
# give up
#
echo "FATAL: `date` for $host failed to connect/sync 10 times" >>$out 2>&1
eval $cleanup
exit 1
|