if ! mkdir lock &>/dev/null then echo "aibackup is already running. Aborting." exit 0 else trap 'rmdir lock; exit 0' 0 1 2 3 mkdir lock fi