

SQLITE_QUEUES_DIR=/var/lib/yandex/maps/mrc/signal_queue
SHARED_MEMORY_DIR=/dev/shm
PERSISTENT_VOLUME=/graph

mkdir -p ${SHARED_MEMORY_DIR}${SQLITE_QUEUES_DIR}

if [ -e ${PERSISTENT_VOLUME}${SHARED_MEMORY_DIR}${SQLITE_QUEUES_DIR} ]; then
    cp -a ${PERSISTENT_VOLUME}${SHARED_MEMORY_DIR}${SQLITE_QUEUES_DIR}/* ${SHARED_MEMORY_DIR}${SQLITE_QUEUES_DIR}
fi

chown -R www-data:www-data ${SHARED_MEMORY_DIR}${SQLITE_QUEUES_DIR}

rm -rf ${SQLITE_QUEUES_DIR}
ln -s ${SHARED_MEMORY_DIR}${SQLITE_QUEUES_DIR} ${SQLITE_QUEUES_DIR}
