#!/bin/sh -e

GRAPHITE_ROOT="/Berkanavt/mega-graphite/"

APP="storage"
APP_ROOT="${GRAPHITE_ROOT}/${APP}"

USER="user_mgstorage"
GROUP="group_solomon"

case "$1" in
    configure)
        /bin/chown ${USER}:${GROUP} ${APP_ROOT}
        if [ -f /etc/init/mega-graphite-${APP}.conf ] ; then
            if ! /usr/bin/service mega-graphite-${APP} restart ; then
                echo "Cannot restart ${APP} service!"
            fi
        fi
    ;;
esac
