"Fossies" - the Fresh Open Source Software Archive 
Member "fou4s-0.16.0/examples/check_fou4s.sh" (11 May 2005, 1734 Bytes) of package /linux/privat/old/fou4s-0.16.0.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/bin/sh
2
3 ######################################Header Information
4 # check_fou4s v0.1
5 # by William R. Jacqmein // Mitsubishi Chemical America
6 # based on check_yum v0.6
7 #
8 # REQUIREMENTS:
9 # Install fou4s from http://fou4s.gaugusch.at/index.shtml
10
11 PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
12 PROGNAME=`basename $0`
13 PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
14 REVISION=`echo '$Revision: 1.2 $' | sed -e 's/[^0-9.]//g'`
15 FOU4S=/usr/sbin/fou4s
16
17 print_revision(){
18 echo $1 $2
19 }
20
21 print_usage() {
22 echo "Usage: $PROGNAME [host]"
23 }
24
25 print_help() {
26 print_revision $PROGNAME $REVISION
27 echo
28 print_usage
29 echo "Will check with fou4s is see if a SuSE install is update-to-date with the latest"
30 echo "patches. The only parameter that is supported, is a host name that is contacted"
31 echo "via ssh. You can also use the user@host scheme."
32 echo
33 exit 0
34 }
35
36 check_host() {
37 if [ -n "$1" ] ; then
38 updates=`ssh "$1" "$FOU4S -e --nocolor | grep 'update.s., total' | awk '{print \\\$1;}'"`
39 else
40 updates=`/usr/sbin/fou4s -e --nocolor | grep "update.s., total" | awk '{print $1;}'`
41 fi
42 ret=$?
43 if [[ -z $updates ]] && [[ $ret -eq 0 ]] ; then
44 echo "FOU4S OK - System is up-to-date"
45 exit 0
46 elif [[ $updates != [0-9]* ]] ; then
47 echo "FOU4S CRITICAL - Unknown error!"
48 exit 2
49 elif [ $updates -gt 1 ] ; then
50 echo "FOU4S WARNING - $updates packages need to be updated!"
51 exit 1
52 elif [ $updates -gt 0 ] ; then
53 echo "FOU4S WARNING - $updates package needs to be updated!"
54 exit 1
55 else
56 echo "FOU4S CRITICAL - Unknown error!"
57 exit 2
58 fi
59 }
60
61 case "$1" in
62 --help|-h)
63 print_help
64 exit 0
65 ;;
66 --version|-V)
67 print_revision $PROGNAME $REVISION
68 exit 0
69 ;;
70 *)
71 check_host "$1"
72 ;;
73 esac