__file: notify when doing changes

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2013-01-20 18:11:47 +01:00
parent 61747c4cb7
commit 7a41d6d8fa
2 changed files with 5 additions and 0 deletions

View file

@ -41,6 +41,7 @@ if [ "$state_should" = "present" -o "$state_should" = "exists" ]; then
if [ "$local_cksum" != "$remote_cksum" ]; then
echo "$__remote_copy" "$source" "${__target_host}:${destination}"
echo "copy" >> "$__object/notifications"
fi
else
echo "Source \"$source\" does not exist." >&2

View file

@ -38,17 +38,20 @@ case "$state_should" in
# Group
if [ -f "$__object/parameter/group" ]; then
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\"
echo "chgrp" >> "$__object/notifications"
fi
# Owner
if [ -f "$__object/parameter/owner" ]; then
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\"
echo "chown" >> "$__object/notifications"
fi
# Mode - needs to happen last as a chown/chgrp can alter mode by
# clearing S_ISUID and S_ISGID bits (see chown(2))
if [ -f "$__object/parameter/mode" ]; then
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\"
echo "chmod" >> "$__object/notifications"
fi
;;
@ -56,6 +59,7 @@ case "$state_should" in
if [ "$exists" = "yes" ]; then
echo rm -f \"$destination\"
echo "removal" >> "$__object/notifications"
fi
;;