From 7d91707c999600f45a682b3e7e423bc71ea6adfe Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Wed, 26 Feb 2014 06:08:20 -0500 Subject: [PATCH] Differentiate between a remove_lock and the failure mode. Ensure that if there isn't really a failure, we don't generate errors, but if there is a failure, that goes into the conky output. --- calendar-run.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/calendar-run.sh b/calendar-run.sh index eef411c..25e1cdd 100755 --- a/calendar-run.sh +++ b/calendar-run.sh @@ -13,21 +13,23 @@ /usr/bin/lockfile -r 8 ~/.running-calendar remove_lock() { + set +e + /bin/rm -f ~/.running-calendar + trap - INT TERM EXIT + exit 0 +} +remove_lock_and_fail() { + echo '${color5}' $! $# 'Failure in' $0 ': Aborting!' /bin/rm -f ~/.running-calendar } # It's a TRAP!!! -trap remove_lock INT TERM EXIT +trap remove_lock_and_fail INT TERM EXIT set -e HOME_MACHINE=baptist.ebb.org ~/hacks/Small-Hacks/calendar-export.plx ~/Public-Configuration/calendar-export-home.config -if [ $? -ne 0 ]; then - echo '${color5} Failure in $0: Aborting after export' - remove_lock - exit 1 -fi cd ~/calendars/personal/private/bkuhn