X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=crontab.d%2Fupdate.sh;h=ca08be1c080a5b18112fed33f602a6f6cd220280;hb=a29bfecac4e3aaa9b47e213d6df04ff247871dce;hp=cfdcbcc5a3364562ac3b2b0555c06d2e94fbf3f2;hpb=c1a3d00240d108fdaf6867cc3a257a4ff6a48834;p=config%2Fdotfiles.git diff --git a/crontab.d/update.sh b/crontab.d/update.sh index cfdcbcc..ca08be1 100755 --- a/crontab.d/update.sh +++ b/crontab.d/update.sh @@ -5,7 +5,7 @@ # # An existing crontab entry not generated with this script is not overwritten. -# Copyright (C) 2012 Simon Ruderich +# Copyright (C) 2012-2013 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +26,8 @@ set -e HEADER_WARNING="# WARNING! DO NOT EDIT THIS FILE! #" -# Don't overwrite existing crontab entries. +# Don't overwrite existing crontab entries. Not race condition free but that +# can't be helped. if crontab -l >/dev/null 2>&1; then if crontab -l | head -n3 | grep "^$HEADER_WARNING$" >/dev/null; then : @@ -42,6 +43,7 @@ if test ! -d "$DIRECTORY" || test ! -O "$DIRECTORY"; then exit 1 fi +# `set -e` aborts when `mktemp` fails. CRONTAB=`mktemp --tmpdir="$DIRECTORY" update-crontab.XXXXXXXXXXXX` echo "###################################" > "$CRONTAB"