File: ocsinventory-agent.cron

package info (click to toggle)
ocsinventory-agent 2%3A2.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,424 kB
  • sloc: perl: 26,492; xml: 773; objc: 528; sh: 386; ansic: 333; makefile: 12
file content (41 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
NAME=ocsinventory-agent

exec >>/var/log/$NAME/$NAME.log 2>&1 

[ -f   /etc/sysconfig/$NAME ] || exit 0
source /etc/sysconfig/$NAME
export PATH

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/$NAME"

		elif [ ! -z "${OCSSERVER[$i]}" ]; then
	        	# Remote inventory
		        OPTS="$OPTS --lazy --nolocal --server=${OCSSERVER[$i]}"
		        if [ ! -z "${OCSPROXYSERVER[$i]}" ]; then
		        	OPTS="$OPTS --proxy=${OCSPROXYSERVER[$i]}"
		        fi
		fi

		echo "[$(date '+%c')] Running $NAME $OPTS"
		/usr/sbin/$NAME  $OPTS
	fi
	((i++))
done
echo "[$(date '+%c')] End of cron job ($PATH)"