#!/bin/bash set -ou pipefail LASTRUN="/var/lib/runtime/$(basename "$0" .sh).lastrun" if [[ $(pgrep -c "$(basename "$0" .sh)" ) -gt 1 ]]; then echo "Script already running. Abort!" >&2 exit 1 fi /usr/bin/dsmc inc >> /var/log/tivoli/tsm.log 2>&1 DSMCRETURN=$? if [[ "$DSMCRETURN" -ne 0 && "$DSMCRETURN" -ne 8 ]]; then echo "Error during dsmc execution occurred." >&2 exit 1 fi date +%s > "$LASTRUN" exit 0