Revision 10c5c1c3

b/daemons/daemon-util.in
51 51
  return 0
52 52
}
53 53

  
54
# Checks the exit code of a daemon
55
check_exitcode() {
56
  if [[ "$#" -lt 1 ]]; then
57
    echo 'Missing exit code.' >&2
58
    return 1
59
  fi
60

  
61
  local rc="$1"; shift
62

  
63
  case "$rc" in
64
    0) ;;
65
    11)
66
      echo "not master"
67
    ;;
68
    *)
69
      echo "exit code $rc"
70
      return 1
71
    ;;
72
  esac
73

  
74
  return 0
75
}
76

  
54 77
# Checks whether daemon is running
55 78
check() {
56 79
  if [[ "$#" -lt 1 ]]; then
b/doc/examples/ganeti.initd.in
29 29

  
30 30
check_exitcode() {
31 31
    RC=$1
32
    case $RC in
33
        0)
34
            log_action_end_msg 0
35
            ;;
36
        11)
37
            log_action_end_msg 0 "not master"
38
            ;;
39
        *)
40
            log_action_end_msg 1 "exit code $RC"
41
            ;;
42
    esac
32

  
33
    if errmsg=$($DAEMON_UTIL check-exitcode $RC)
34
    then
35
        log_action_end_msg 0 "$errmsg"
36
    else
37
        log_action_end_msg 1 "$errmsg"
38
    fi
43 39
}
44 40

  
45 41
start_action() {

Also available in: Unified diff