fix: also for cron
This commit is contained in:
parent
7c455db717
commit
5269414564
1 changed files with 13 additions and 3 deletions
|
@ -1,14 +1,24 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
for cronfile in skel/etc/cron.d/*; do
|
for cronfile in skel/etc/cron.d/*; do
|
||||||
|
basename=$(basename $cronfile)
|
||||||
|
sum=$(sha1sum $cronfile)
|
||||||
|
if [ -f .neb/cron/$basename-sum.txt ]; then
|
||||||
|
[ "$(cat .neb/cron/$basename-sum.txt)" = "$sum" ] && continue
|
||||||
|
else
|
||||||
|
mkdir -p .neb/cron
|
||||||
|
fi
|
||||||
|
|
||||||
echo "checking $cronfile..."
|
echo "checking $cronfile..."
|
||||||
if ! echo "$cronfile" | grep -q "."; then
|
if ! echo "$cronfile" | grep -q "."; then
|
||||||
echo "$cronfile: crontabs may not have an extension"
|
echo "$cronfile: crontabs may not have an extension"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! [ $(tail -c1 "$cronfile" | wc -l) -gt 0 ]; then
|
if ! crontab -T $cronfile &> /dev/null; then
|
||||||
echo "$cronfile: crontabs must end with a newline"
|
echo "$cronfile: crontab syntax error"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "$sum" > .neb/cron/$basename-sum.txt
|
||||||
done
|
done
|
Loading…
Reference in a new issue