summaryrefslogtreecommitdiff
path: root/shutdownasap.conf.in
blob: f4ccc404ff1b4ba90ae80eb63daffb709de3089d (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

# configuration file for shutdownasap
# it should be named #ETCDIR#/shutdownasap.conf

# directory for inter-instance communication, etc.
tmpDir="/tmp/tmp.shutdownasap"

# directory must be empty before shutdown
waitForDir="/home/shutdown/.warteauf"

# list of processes which must not be running before shutdown
declare -A shutDownNoGoProcesses

shutDownNoGoProcesses["backup"]="[^/ ]*backup"
shutDownNoGoProcesses["cryptsetup"]="cryptsetup"
shutDownNoGoProcesses["dd"]="dd"
shutDownNoGoProcesses["git-upload-pack"]="git-upload-pack"
shutDownNoGoProcesses["integritysetup"]="integritysetup"
shutDownNoGoProcesses["ncat"]="ncat"
shutDownNoGoProcesses["ports"]="ports"
shutDownNoGoProcesses["prt-get"]="prt-get"
shutDownNoGoProcesses["rsync"]="rsync"
shutDownNoGoProcesses["scp"]="scp"
shutDownNoGoProcesses["sync.sh"]="sync.sh"
shutDownNoGoProcesses["update-me"]="update-me"
shutDownNoGoProcesses["update.sh"]="update.sh"
shutDownNoGoProcesses["wget"]="wget"

# list of PID files whose processes must not be running before shutdown
declare -A shutDownNoGoFiles

shutDownNoGoFiles["wetter"]="/tmp/wetter.pid"

# hook to execute after start of shutdownasap, before watching above conditions
beforeWatchHook() {
  true
}

# This hook should return != 0, if we should keep waiting for shutdown.
# Note, that it is queried often.
additionalWatchHookFast() {
  if command -v check-if-bareos-backup-is-running \
  && ! check-if-bareos-backup-is-running; then
    return 1
  fi
  return 0
}

# This hook should return != 0, if we should keep waiting for shutdown.
# Note, that it is queried seldom (e.g. once, if it returns 0).
additionalWatchHookSlow() {
  return 0
}

# hook to execute before shutting down
beforeShutDownHook() {
  if command -v doalogwatch >/dev/null; then
    doalogwatch
  fi
  true
}