Merge branch 'master' of github.com:ungleich/cdist
This commit is contained in:
commit
d9422342d3
2 changed files with 15 additions and 6 deletions
|
@ -22,4 +22,9 @@
|
||||||
name="$__object_name"
|
name="$__object_name"
|
||||||
user="$(cat "$__object/parameter/user")"
|
user="$(cat "$__object/parameter/user")"
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/raw_command" ]; then
|
||||||
|
command="$(cat "$__object/parameter/command")"
|
||||||
|
crontab -u $user -l 2>/dev/null | grep "^$command\$" || true
|
||||||
|
else
|
||||||
crontab -u $user -l 2>/dev/null | grep "# $name\$" || true
|
crontab -u $user -l 2>/dev/null | grep "# $name\$" || true
|
||||||
|
fi
|
||||||
|
|
10
cdist/conf/type/__cron/gencode-remote
Executable file → Normal file
10
cdist/conf/type/__cron/gencode-remote
Executable file → Normal file
|
@ -26,7 +26,7 @@ command="$(cat "$__object/parameter/command")"
|
||||||
|
|
||||||
if [ -f "$__object/parameter/raw" ]; then
|
if [ -f "$__object/parameter/raw" ]; then
|
||||||
raw="$(cat "$__object/parameter/raw")"
|
raw="$(cat "$__object/parameter/raw")"
|
||||||
entry="$raw $command"
|
entry="$raw $command # $name"
|
||||||
elif [ -f "$__object/parameter/raw_command" ]; then
|
elif [ -f "$__object/parameter/raw_command" ]; then
|
||||||
entry="$command"
|
entry="$command"
|
||||||
else
|
else
|
||||||
|
@ -35,10 +35,9 @@ else
|
||||||
day_of_month="$(cat "$__object/parameter/day_of_month" 2>/dev/null || echo "*")"
|
day_of_month="$(cat "$__object/parameter/day_of_month" 2>/dev/null || echo "*")"
|
||||||
month="$(cat "$__object/parameter/month" 2>/dev/null || echo "*")"
|
month="$(cat "$__object/parameter/month" 2>/dev/null || echo "*")"
|
||||||
day_of_week="$(cat "$__object/parameter/day_of_week" 2>/dev/null || echo "*")"
|
day_of_week="$(cat "$__object/parameter/day_of_week" 2>/dev/null || echo "*")"
|
||||||
entry="$minute $hour $day_of_month $month $day_of_week $command"
|
entry="$minute $hour $day_of_month $month $day_of_week $command # $name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
entry="$entry # $name"
|
|
||||||
mkdir "$__object/files"
|
mkdir "$__object/files"
|
||||||
echo "$entry" > "$__object/files/entry"
|
echo "$entry" > "$__object/files/entry"
|
||||||
|
|
||||||
|
@ -85,7 +84,12 @@ case "$state_should" in
|
||||||
echo ") | crontab -u $user -"
|
echo ") | crontab -u $user -"
|
||||||
;;
|
;;
|
||||||
absent)
|
absent)
|
||||||
|
if [ -f "$__object/parameter/raw_command" ]; then
|
||||||
|
echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
|
||||||
|
echo "grep -v \"^$entry\\$\" | crontab -u $user -"
|
||||||
|
else
|
||||||
echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
|
echo "( crontab -u $user -l 2>/dev/null | grep -v -E \"$filter\" 2>/dev/null || true ) | \\"
|
||||||
echo "grep -v \"# $name\\$\" | crontab -u $user -"
|
echo "grep -v \"# $name\\$\" | crontab -u $user -"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue