1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/bash set -e mkdir -p ${MDA_DIR} # TODO: use flock to lock the file, to prevent atomic writes. cat >> ${MDA_DIR}/.tmp-${1} X=$? if [ -e ${MDA_DIR}/.tmp-${1} ]; then mv ${MDA_DIR}/.tmp-${1} ${MDA_DIR}/${1} fi exit $X