Merge branch 'master' of mathias-kettner.de:omd
[omd.git] / packages / omd / init_profile
blob671945cd1ed1d7eaf6e65907bef78d1d0635cc0f
1 #!/bin/sh
3 __init_hook() {
4 # Takes 3 parameters
5 # 1. Name of the init-script (can be the full path name, we will only use the file part)
6 # 2. The command the init-script was called with (start, stop, reload,..)
7 # 3. A fixed string, either "pre" os "post"
8 # 4. return code of the command (optional, and only for post hooks)
9 if [ -h $1 ]; then file=$(readlink $1); else file=$1; fi
10 hook=$(printf "$OMD_ROOT/etc/init-hooks.d/%s-%s-%s" ${file##*/} $2 $3)
11 if [ -x "$hook" ]; then
12 $hook ${file##*/} $2 $3 $4
13 elif [ -e "$hook" ]; then
14 echo "WARNING: hook $hook exists but is not executable."