1#!/bin/sh
2
3#
4# Start rancid and display result on stdout instead of sending it by mail
5#
6# Syntax:
7#	start-rancid [eq ... eq]
8#
9# History
10#   2007/07/03 : pda/jean : design
11#   2010/10/20 : pda/jean : topo integration
12#   2010/12/18 : pda      : rework installation
13#
14
15eval `%CONFPROG% \
16		rancidcmd \
17		topobindir \
18		`
19
20# In the topodir directory, the fake sendmail program sends result
21# on file descripor number 3 (instead of sending mail).
22# We have to collect these mails (got on descriptor 3) and redirect
23# them to stdout.
24
25SENDMAILDIR="$topobindir"
26PATH=$SENDMAILDIR:$PATH
27export PATH
28
29if [ $# = 0 ]
30then
31    exec $rancidcmd 3>&1
32else
33    error=0
34    for eq in $*
35    do
36	$rancidcmd -r $eq 3>&1
37	if [ $? != 0 ]
38	then error=1
39	fi
40    done
41    exit $error
42fi
43