Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > media > contrib-testing > by-pkgid > 0708d07c35561e35d41e82b064f984df > files > 1

ocsinventory-agent-1.02-2.1mdv2009.0.noarch.rpm

#!/bin/bash

exec >>/var/log/ocsinventory-agent/ocsinventory-agent.log 2>&1 

[ -f   /etc/sysconfig/ocsinventory-agent ] || exit 0
source /etc/sysconfig/ocsinventory-agent

i=0
while [ $i -lt ${#OCSMODE[*]} ]
do
	if [ ${OCSMODE[$i]:-none} == cron ]; then
		OPTS=
		if [ ! -z "${OCSPAUSE[$i]}" ]; then
			OPTS="--wait ${OCSPAUSE[$i]}"
		fi

		if [ ! -z "${OCSTAG[$i]}" ]; then
		        OPTS="$OPTS --tag=${OCSTAG[$i]}"
		fi

		if [ "z${OCSSERVER[$i]}" = 'zlocal' ]; then
	        	# Local inventory
	        	OPTS="$OPTS --local=/var/lib/ocsinventory-agent"
		elif [ ! -z "${OCSSERVER[$i]}" ]; then
	        	# Remote inventory
		        OPTS="$OPTS --lazy --server=${OCSSERVER[$i]}"	
		fi
		echo "[$(date '+%D %T')]" Running ocsinventory-agent $OPTS
		/usr/sbin/ocsinventory-agent  $OPTS
	fi
	((i++))
done
echo "[$(date '+%D %T')] End of cron job"