source: trunk/debathena/debathena/verify/debian/verify_ws @ 25637

Revision 25637, 944 bytes checked in by jdreed, 12 years ago (diff)
In verify: * Initial release.
Line 
1#!/bin/sh
2
3statfile=/var/lib/verify_ws-status
4nologinfile=/var/run/athena-nologin
5updstatus=unknown
6updmsg=unknown
7
8[ -e /var/run/athena-login ] && exit || touch $nologinfile
9
10save_state() {
11    rm -f $statfile
12    echo "$(date +"%s")|$updstatus|$updmsg" > $statfile
13}
14
15cleanup() {
16    rm -f $nologinfile
17    save_state
18    exit
19}
20
21trap cleanup EXIT
22
23fail() {
24    logger -t "verify_ws" -p user.notice "$*"
25    updstatus=failed
26    updmsg="$*"
27    exit
28}
29
30warn() {
31    updstatus=warning
32    updmsg="$*"
33    exit
34}
35
36succeed() {
37    updstatus=ok
38    updmsg="$*"
39    exit
40}
41
42if ! [ -x /usr/lib/debathena-verify/verify_ws.pl ]; then
43    fail "Can't execute /usr/lib/debathena-verify/verify_ws.pl"
44fi
45
46if /usr/lib/debathena-verify/verify_ws.pl; then
47    succeed "Verification passed"
48else
49    case $? in
50        1)
51            fail "Verification failed"
52            ;;
53        2)
54            warn "Non-fatal errors found"
55            ;;
56        *)
57            fail "unknown error"
58            ;;
59    esac
60fi
61exit
Note: See TracBrowser for help on using the repository browser.